diff --git a/src/main.rs b/src/main.rs index e063b813c..0733ff14a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -205,16 +205,8 @@ fn main() -> Result<()> { NUSHELL_FOLDER, is_perf_true(), ); + // only want to load config and env if relative argument is provided. - if binary_args.config_file.is_some() { - config_files::read_config_file( - &mut engine_state, - &mut stack, - binary_args.config_file, - is_perf_true(), - false, - ); - } if binary_args.env_file.is_some() { config_files::read_config_file( &mut engine_state, @@ -225,6 +217,16 @@ fn main() -> Result<()> { ); } + if binary_args.config_file.is_some() { + config_files::read_config_file( + &mut engine_state, + &mut stack, + binary_args.config_file, + is_perf_true(), + false, + ); + } + let ret_val = evaluate_commands( commands, &init_cwd, @@ -250,16 +252,8 @@ fn main() -> Result<()> { NUSHELL_FOLDER, is_perf_true(), ); + // only want to load config and env if relative argument is provided. - if binary_args.config_file.is_some() { - config_files::read_config_file( - &mut engine_state, - &mut stack, - binary_args.config_file, - is_perf_true(), - false, - ); - } if binary_args.env_file.is_some() { config_files::read_config_file( &mut engine_state, @@ -270,6 +264,16 @@ fn main() -> Result<()> { ); } + if binary_args.config_file.is_some() { + config_files::read_config_file( + &mut engine_state, + &mut stack, + binary_args.config_file, + is_perf_true(), + false, + ); + } + let ret_val = evaluate_file( script_name, &args_to_script,