Skip to content

Commit

Permalink
activate: use less aggressive PATH modifications by default
Browse files Browse the repository at this point in the history
Use `settings set activate_aggressive 1` to disable this change.

Fixes #863
  • Loading branch information
jdx committed Jan 12, 2024
1 parent 5b66532 commit 07e1921
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@
]
},
"settings": {
"activate_aggressive": {
"description": "push tools to the front of PATH instead of allowing modifications of PATH after activation to take precedence",
"type": "boolean"
},
"all_compile": {
"description": "do not use precompiled binaries for any tool",
"type": "boolean"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/hook_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl HookEnv {
.to_string();
let (pre, post) = match &*env::__MISE_ORIG_PATH {
Some(orig_path) => match full.split_once(&format!(":{orig_path}")) {
Some((pre, post)) if settings.experimental => {
Some((pre, post)) if !settings.activate_aggressive => {
(pre.to_string(), (orig_path.to_string() + post))
}
_ => (String::new(), full),
Expand Down
1 change: 1 addition & 0 deletions src/cli/settings/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mod tests {
fn test_settings_ls() {
reset_config();
assert_cli_snapshot!("settings", @r###"
activate_aggressive = false
all_compile = false
always_keep_download = true
always_keep_install = true
Expand Down
1 change: 1 addition & 0 deletions src/cli/settings/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub mod tests {
);

assert_cli_snapshot!("settings", @r###"
activate_aggressive = false
all_compile = false
always_keep_download = false
always_keep_install = false
Expand Down
1 change: 1 addition & 0 deletions src/cli/settings/unset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mod tests {
assert_cli!("settings", "unset", "legacy_version_file");

assert_cli_snapshot!("settings", @r###"
activate_aggressive = false
all_compile = false
always_keep_download = true
always_keep_install = true
Expand Down
3 changes: 3 additions & 0 deletions src/config/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use crate::{env, file};
#[config(partial_attr(derive(Clone, Serialize, Default)))]
#[config(partial_attr(serde(deny_unknown_fields)))]
pub struct Settings {
/// push tools to the front of PATH instead of allowing modifications of PATH after activation to take precedence
#[config(env = "MISE_ACTIVATE_AGGRESSIVE", default = false)]
pub activate_aggressive: bool,
#[config(env = "MISE_ALL_COMPILE", default = false)]
pub all_compile: bool,
#[config(env = "MISE_ALWAYS_KEEP_DOWNLOAD", default = false)]
Expand Down

0 comments on commit 07e1921

Please sign in to comment.