mirror of
https://github.com/nushell/nushell.git
synced 2025-06-20 01:48:09 +02:00
refactor(autoload): simplify nu_autoload_on_command logic to check for existence of environment variable
This commit is contained in:
parent
6ae491a6d8
commit
0cf878c5dc
@ -175,16 +175,7 @@ fn read_and_sort_directory(path: &Path) -> Result<Vec<String>> {
|
||||
|
||||
pub(crate) fn nu_autoload_on_command(engine_state: &EngineState, stack: &Stack) -> bool {
|
||||
let env_vars = stack.get_env_vars(engine_state);
|
||||
env_vars
|
||||
.get("NU_AUTOLOAD_ON_COMMAND")
|
||||
.and_then(|val| {
|
||||
if let Ok(val_str) = val.as_str() {
|
||||
Some(val_str.to_lowercase() == "true")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or(false)
|
||||
env_vars.get("NU_AUTOLOAD_ON_COMMAND").is_some()
|
||||
}
|
||||
|
||||
pub(crate) fn read_vendor_autoload_files(engine_state: &mut EngineState, stack: &mut Stack) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user