-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add no hooks and no env flags #7560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Test that --no-env flag prevents loading environment variables from config files | ||
|
|
||
| # Create a config file with environment variables | ||
| cat <<EOF >mise.toml | ||
| [env] | ||
| TEST_FOO_VAR = "FOO" | ||
| EOF | ||
|
|
||
| # Test if it works with env | ||
| assert_contains "mise env" "TEST_FOO_VAR" | ||
| assert_not_contains "mise --no-env env" "TEST_FOO_VAR" | ||
|
|
||
| # Test with exec as well | ||
| assert_contains "mise exec -- env | grep TEST_FOO_VAR" "TEST_FOO_VAR=FOO" | ||
| assert_not_contains "mise --no-env exec -- env" "TEST_FOO_VAR" | ||
|
|
||
| # Test that MISE_NO_ENV=1 environment variable works the same way | ||
| assert_not_contains "MISE_NO_ENV=1 mise env" "TEST_FOO_VAR" | ||
| assert_not_contains "MISE_NO_ENV=1 mise exec -- env" "TEST_FOO_VAR" | ||
|
|
||
| cat <<EOF >mise.toml | ||
| [settings] | ||
| no_env = true | ||
|
|
||
| [env] | ||
| TEST_FOO_VAR = "FOO" | ||
| EOF | ||
|
|
||
| assert_not_contains "mise env" "TEST_FOO_VAR" | ||
|
|
||
| # Cleanup | ||
| rm -f mise.toml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| cat <<EOF >mise.toml | ||
| [settings] | ||
| experimental = true | ||
| [tools] | ||
| dummy = 'latest' | ||
| [hooks] | ||
| preinstall = 'echo PREINSTALL' | ||
| EOF | ||
|
|
||
| assert_contains "mise i dummy 2>&1" "PREINSTALL" | ||
| assert_not_contains "mise --no-hooks i dummy 2>&1" "PREINSTALL" | ||
|
|
||
| assert_not_contains "MISE_NO_HOOKS=1 mise --no-hooks i dummy 2>&1" "PREINSTALL" | ||
|
|
||
| cat <<EOF >mise.toml | ||
| [settings] | ||
| experimental = true | ||
| no_hooks = true | ||
| [tools] | ||
| dummy = 'latest' | ||
| [hooks] | ||
| preinstall = 'echo PREINSTALL' | ||
| EOF | ||
|
|
||
| assert_not_contains "mise i dummy 2>&1" "PREINSTALL" | ||
|
|
||
| rm -f mise.toml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,8 @@ pub static MISE_FRIENDLY_ERROR: Lazy<bool> = Lazy::new(|| { | |
| pub static MISE_TOOL_STUB: Lazy<bool> = | ||
| Lazy::new(|| ARGS.read().unwrap().get(1).map(|s| s.as_str()) == Some("tool-stub")); | ||
| pub static MISE_NO_CONFIG: Lazy<bool> = Lazy::new(|| var_is_true("MISE_NO_CONFIG")); | ||
| pub static MISE_NO_ENV: Lazy<bool> = Lazy::new(|| var_is_true("MISE_NO_ENV")); | ||
| pub static MISE_NO_HOOKS: Lazy<bool> = Lazy::new(|| var_is_true("MISE_NO_HOOKS")); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this not done in settings.toml?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that is shall be just CLI flags to be used dynamically. However If I put it in the settings It could still work dynamically using the env variables.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be both global flags and settings. If you put it into settings.toml it will be documented as a setting
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the options in the settings file |
||
| pub static MISE_PROGRESS_TRACE: Lazy<bool> = Lazy::new(|| var_is_true("MISE_PROGRESS_TRACE")); | ||
| pub static MISE_CACHE_DIR: Lazy<PathBuf> = | ||
| Lazy::new(|| var_path("MISE_CACHE_DIR").unwrap_or_else(|| XDG_CACHE_HOME.join("mise"))); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.