diff --git a/src/cli/doctor/mod.rs b/src/cli/doctor/mod.rs index 1e16e3ced7..b7a355b688 100644 --- a/src/cli/doctor/mod.rs +++ b/src/cli/doctor/mod.rs @@ -7,7 +7,7 @@ use crate::backend::backend_type::BackendType; use crate::build_time::built_info; use crate::cli::version; use crate::cli::version::VERSION; -use crate::config::Config; +use crate::config::{Config, IGNORED_CONFIG_FILES}; use crate::env::PATH_KEY; use crate::file::display_path; use crate::git::Git; @@ -111,6 +111,21 @@ impl Doctor { .map(|p| p.to_string_lossy().to_string()) .collect(), ); + data.insert( + "config_files".into(), + config + .config_files + .keys() + .map(|p| p.to_string_lossy().to_string()) + .collect(), + ); + data.insert( + "ignored_config_files".into(), + IGNORED_CONFIG_FILES + .iter() + .map(|p| p.to_string_lossy().to_string()) + .collect(), + ); let tools = ts.list_versions_by_plugin().into_iter().map(|(f, tv)| { let versions: serde_json::Value = tv @@ -241,6 +256,15 @@ impl Doctor { let config = config.as_ref(); info::section("config_files", render_config_files(config))?; + if IGNORED_CONFIG_FILES.is_empty() { + println!(); + info::inline_section("ignored_config_files", "(none)")?; + } else { + info::section( + "ignored_config_files", + IGNORED_CONFIG_FILES.iter().map(display_path).join("\n"), + )?; + } info::section("backends", render_backends())?; info::section("plugins", render_plugins())?; diff --git a/src/config/mod.rs b/src/config/mod.rs index 225ad8bc15..110be320af 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -861,6 +861,12 @@ pub static ALL_CONFIG_FILES: Lazy> = Lazy::new(|| { .into_iter() .collect() }); +pub static IGNORED_CONFIG_FILES: Lazy> = Lazy::new(|| { + load_config_paths(&DEFAULT_CONFIG_FILENAMES, true) + .into_iter() + .filter(|p| config_file::is_ignored(p)) + .collect() +}); // pub static LOCAL_CONFIG_FILES: Lazy> = Lazy::new(|| { // ALL_CONFIG_FILES // .iter() @@ -901,9 +907,10 @@ pub fn load_config_paths(config_filenames: &[String], include_ignored: bool) -> let mut config_files = dirs .par_iter() .flat_map(|dir| { - if env::MISE_IGNORED_CONFIG_PATHS - .iter() - .any(|p| dir.starts_with(p)) + if !include_ignored + && env::MISE_IGNORED_CONFIG_PATHS + .iter() + .any(|p| dir.starts_with(p)) { vec![] } else {