mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 17:15:02 +02:00
Move config to be an env var (#5230)
* Move config to be an env var * fix fmt and tests
This commit is contained in:
@ -317,7 +317,7 @@ Format: #
|
||||
let list: bool = call.has_flag("list");
|
||||
let escape: bool = call.has_flag("escape");
|
||||
let osc: bool = call.has_flag("osc");
|
||||
let use_ansi_coloring = stack.get_config()?.use_ansi_coloring;
|
||||
let use_ansi_coloring = engine_state.get_config().use_ansi_coloring;
|
||||
|
||||
if list {
|
||||
return generate_ansi_code_list(engine_state, call.head, use_ansi_coloring);
|
||||
|
@ -25,14 +25,14 @@ impl Command for KeybindingsListen {
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
stack: &mut Stack,
|
||||
engine_state: &EngineState,
|
||||
_stack: &mut Stack,
|
||||
_call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
println!("Type any key combination to see key details. Press ESC to abort.");
|
||||
|
||||
match print_events(stack) {
|
||||
match print_events(engine_state) {
|
||||
Ok(v) => Ok(v.into_pipeline_data()),
|
||||
Err(e) => {
|
||||
terminal::disable_raw_mode()?;
|
||||
@ -56,8 +56,8 @@ impl Command for KeybindingsListen {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_events(stack: &mut Stack) -> Result<Value, ShellError> {
|
||||
let config = stack.get_config()?;
|
||||
pub fn print_events(engine_state: &EngineState) -> Result<Value, ShellError> {
|
||||
let config = engine_state.get_config();
|
||||
|
||||
stdout().flush()?;
|
||||
terminal::enable_raw_mode()?;
|
||||
@ -78,7 +78,7 @@ pub fn print_events(stack: &mut Stack) -> Result<Value, ShellError> {
|
||||
Value::Record { cols, vals, .. } => cols
|
||||
.iter()
|
||||
.zip(vals.iter())
|
||||
.map(|(x, y)| format!("{}: {}", x, y.into_string("", &config)))
|
||||
.map(|(x, y)| format!("{}: {}", x, y.into_string("", config)))
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
|
||||
|
Reference in New Issue
Block a user