diff --git a/crates/nu-command/src/help/help_.rs b/crates/nu-command/src/help/help_.rs index d2a8eda894..fb1c0bcb9b 100644 --- a/crates/nu-command/src/help/help_.rs +++ b/crates/nu-command/src/help/help_.rs @@ -95,7 +95,7 @@ You can also learn more at https://www.nushell.sh/book/"#; result }; - let result = if let Err(ShellError::CommandNotFound(_)) = result { + let result = if let Err(ShellError::CommandNotFound { .. }) = result { help_modules(engine_state, stack, call) } else { result diff --git a/crates/nu-command/src/help/help_commands.rs b/crates/nu-command/src/help/help_commands.rs index 4c930ffa30..ef40151018 100644 --- a/crates/nu-command/src/help/help_commands.rs +++ b/crates/nu-command/src/help/help_commands.rs @@ -114,10 +114,9 @@ pub fn help_commands( .into_pipeline_data(), ) } else { - Err(ShellError::CommandNotFound(span(&[ - rest[0].span, - rest[rest.len() - 1].span, - ]))) + Err(ShellError::CommandNotFound { + span: span(&[rest[0].span, rest[rest.len() - 1].span]), + }) } } } diff --git a/crates/nu-command/src/help/help_externs.rs b/crates/nu-command/src/help/help_externs.rs index 4d880bea53..5296e066bf 100644 --- a/crates/nu-command/src/help/help_externs.rs +++ b/crates/nu-command/src/help/help_externs.rs @@ -133,10 +133,9 @@ pub fn help_externs( .into_pipeline_data(), ) } else { - Err(ShellError::CommandNotFound(span(&[ - rest[0].span, - rest[rest.len() - 1].span, - ]))) + Err(ShellError::CommandNotFound { + span: span(&[rest[0].span, rest[rest.len() - 1].span]), + }) } } } diff --git a/crates/nu-engine/src/eval.rs b/crates/nu-engine/src/eval.rs index c4350007dd..2c78fa2dcc 100644 --- a/crates/nu-engine/src/eval.rs +++ b/crates/nu-engine/src/eval.rs @@ -795,10 +795,10 @@ fn eval_element_with_input( ) }) } else { - Err(ShellError::CommandNotFound(*span)) + Err(ShellError::CommandNotFound { span: *span }) } } - _ => Err(ShellError::CommandNotFound(*span)), + _ => Err(ShellError::CommandNotFound { span: *span }), }, PipelineElement::SeparateRedirection { out: (out_span, out_expr), @@ -842,14 +842,14 @@ fn eval_element_with_input( ) }) } else { - Err(ShellError::CommandNotFound(*out_span)) + Err(ShellError::CommandNotFound { span: *out_span }) } } (_out_other, err_other) => { if let Expr::String(_) = err_other { - Err(ShellError::CommandNotFound(*out_span)) + Err(ShellError::CommandNotFound { span: *out_span }) } else { - Err(ShellError::CommandNotFound(*err_span)) + Err(ShellError::CommandNotFound { span: *err_span }) } } }, diff --git a/crates/nu-protocol/src/shell_error.rs b/crates/nu-protocol/src/shell_error.rs index 9fcb1e5f58..476eb47b3f 100644 --- a/crates/nu-protocol/src/shell_error.rs +++ b/crates/nu-protocol/src/shell_error.rs @@ -685,7 +685,10 @@ pub enum ShellError { /// Check the spelling for the requested command and try again. Are you sure it's defined and your configurations are loading correctly? Can you execute it? #[error("Command not found")] #[diagnostic(code(nu::shell::command_not_found))] - CommandNotFound(#[label("command not found")] Span), + CommandNotFound { + #[label("command not found")] + span: Span, + }, /// This alias could not be found ///