diff --git a/src/command.rs b/src/command.rs index 5aab712756..7048f9e39b 100644 --- a/src/command.rs +++ b/src/command.rs @@ -101,6 +101,7 @@ pub(crate) fn parse_commandline_args( let testbin: Option = call.get_flag_expr("testbin"); #[cfg(feature = "plugin")] let plugin_file: Option = call.get_flag_expr("plugin-config"); + let no_config_file = call.get_named_arg("no-config-file"); let config_file: Option = call.get_flag_expr("config"); let env_file: Option = call.get_flag_expr("env-config"); let log_level: Option = call.get_flag_expr("log-level"); @@ -174,6 +175,7 @@ pub(crate) fn parse_commandline_args( testbin, #[cfg(feature = "plugin")] plugin_file, + no_config_file, config_file, env_file, log_level, @@ -205,6 +207,7 @@ pub(crate) struct NushellCliArgs { pub(crate) testbin: Option>, #[cfg(feature = "plugin")] pub(crate) plugin_file: Option>, + pub(crate) no_config_file: Option>, pub(crate) config_file: Option>, pub(crate) env_file: Option>, pub(crate) log_level: Option>, @@ -245,6 +248,11 @@ impl Command for Nu { "the table mode to use. rounded is default.", Some('m'), ) + .switch( + "no-config-file", + "start with no config file and no env file", + Some('n'), + ) .named( "threads", SyntaxShape::Int, diff --git a/src/run.rs b/src/run.rs index 55c2ea9db2..7aeafbff7f 100644 --- a/src/run.rs +++ b/src/run.rs @@ -201,15 +201,18 @@ pub(crate) fn run_repl( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); - setup_config( - &mut engine_state, - &mut stack, - #[cfg(feature = "plugin")] - parsed_nu_cli_args.plugin_file, - parsed_nu_cli_args.config_file, - parsed_nu_cli_args.env_file, - parsed_nu_cli_args.login_shell.is_some(), - ); + if parsed_nu_cli_args.no_config_file.is_none() { + setup_config( + &mut engine_state, + &mut stack, + #[cfg(feature = "plugin")] + parsed_nu_cli_args.plugin_file, + parsed_nu_cli_args.config_file, + parsed_nu_cli_args.env_file, + parsed_nu_cli_args.login_shell.is_some(), + ); + } + // Reload use_color from config in case it's different from the default value let use_color = engine_state.get_config().use_ansi_coloring; perf(