mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 15:39:06 +01:00
REFACTOR: have a single std
loading call (#9033)
# Description this PR moves the three individual call to `load_standard_library` in the "Nushell branches" of `run.rs` into a single one, before the `if`, in `main.rs`. # User-Facing Changes ``` $nothing ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` # After Submitting ``` $nothing ```
This commit is contained in:
parent
9804cd82f8
commit
bdaa32666a
@ -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,
|
||||
|
13
src/run.rs
13
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,
|
||||
|
Loading…
Reference in New Issue
Block a user