diff --git a/src/main.rs b/src/main.rs index 5a42c39bac..c158c8393d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ use nu_cli::gather_parent_env_vars; use nu_command::{create_default_context, get_init_cwd}; use nu_protocol::{report_error_new, Value}; use nu_protocol::{util::BufferedReader, PipelineData, RawStream}; +use nu_std::load_standard_library; use nu_utils::utils::perf; use run::{run_commands, run_file, run_repl}; use signals::{ctrlc_protection, sigquit_protection}; @@ -250,6 +251,10 @@ fn main() -> Result<()> { use_color, ); + if parsed_nu_cli_args.no_std_lib.is_none() { + load_standard_library(&mut engine_state)?; + } + if let Some(commands) = parsed_nu_cli_args.commands.clone() { run_commands( &mut engine_state, diff --git a/src/run.rs b/src/run.rs index 67ef72c9f1..cc4a6d701a 100644 --- a/src/run.rs +++ b/src/run.rs @@ -8,7 +8,6 @@ use crate::{ use nu_cli::read_plugin_file; use nu_cli::{evaluate_commands, evaluate_file, evaluate_repl}; use nu_protocol::PipelineData; -use nu_std::load_standard_library; use nu_utils::utils::perf; pub(crate) fn run_commands( @@ -22,10 +21,6 @@ pub(crate) fn run_commands( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); - if parsed_nu_cli_args.no_std_lib.is_none() { - load_standard_library(engine_state)?; - } - #[cfg(feature = "plugin")] read_plugin_file( engine_state, @@ -113,10 +108,6 @@ pub(crate) fn run_file( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); - if parsed_nu_cli_args.no_std_lib.is_none() { - load_standard_library(engine_state)?; - } - #[cfg(feature = "plugin")] read_plugin_file( engine_state, @@ -214,10 +205,6 @@ pub(crate) fn run_repl( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); - if parsed_nu_cli_args.no_std_lib.is_none() { - load_standard_library(engine_state)?; - } - if parsed_nu_cli_args.no_config_file.is_none() { setup_config( engine_state,