mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:15:49 +02:00
Fix config creation during printing (#9353)
This commit is contained in:
@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use nu_protocol::ast::{Call, Expr, PathMember};
|
||||
use nu_protocol::engine::{EngineState, Stack};
|
||||
use nu_protocol::{PipelineData, ShellError, Span, Value, VarId};
|
||||
use nu_protocol::{Config, PipelineData, ShellError, Span, Value, VarId};
|
||||
|
||||
use nu_path::canonicalize_with;
|
||||
|
||||
@ -303,6 +303,18 @@ pub fn find_in_dirs_env(
|
||||
Ok(check_dir(lib_dirs).or_else(|| check_dir(lib_dirs_fallback)))
|
||||
}
|
||||
|
||||
/// Get config
|
||||
///
|
||||
/// This combines config stored in permanent state and any runtime updates to the environment. This
|
||||
/// is the canonical way to fetch config at runtime when you have Stack available.
|
||||
pub fn get_config(engine_state: &EngineState, stack: &Stack) -> Config {
|
||||
if let Some(mut config_record) = stack.get_env_var(engine_state, "config") {
|
||||
config_record.into_config(engine_state.get_config()).0
|
||||
} else {
|
||||
engine_state.get_config().clone()
|
||||
}
|
||||
}
|
||||
|
||||
fn get_converted_value(
|
||||
engine_state: &EngineState,
|
||||
stack: &Stack,
|
||||
|
Reference in New Issue
Block a user