diff --git a/src/main.rs b/src/main.rs index 856e5d5e7a..3db83f5d49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,6 +195,25 @@ 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, + &mut stack, + binary_args.env_file, + is_perf_true(), + true, + ); + } let ret_val = evaluate_commands( commands, @@ -217,6 +236,25 @@ 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, + &mut stack, + binary_args.env_file, + is_perf_true(), + true, + ); + } let ret_val = evaluate_file( script_name,