Skip to content

Commit

Permalink
feat: added ignored_config_paths to mise dr (#3742)
Browse files Browse the repository at this point in the history
Fixes #3731
  • Loading branch information
jdx authored Dec 20, 2024
1 parent addad3b commit 4727339
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
26 changes: 25 additions & 1 deletion src/cli/doctor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())?;

Expand Down
13 changes: 10 additions & 3 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,12 @@ pub static ALL_CONFIG_FILES: Lazy<IndexSet<PathBuf>> = Lazy::new(|| {
.into_iter()
.collect()
});
pub static IGNORED_CONFIG_FILES: Lazy<IndexSet<PathBuf>> = 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<Vec<PathBuf>> = Lazy::new(|| {
// ALL_CONFIG_FILES
// .iter()
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4727339

Please sign in to comment.