mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
Fix overlay's help message lead to internal error (#9087)
This commit is contained in:
parent
a7c1b363eb
commit
345cdef113
2 changed files with 20 additions and 0 deletions
|
@ -102,6 +102,16 @@ pub fn parse_keyword(
|
|||
{
|
||||
// Apply parse keyword side effects
|
||||
let cmd = working_set.get_decl(call.decl_id);
|
||||
// check help flag first.
|
||||
if call.named_iter().any(|(flag, _, _)| flag.item == "help") {
|
||||
let call_span = call.span();
|
||||
return Pipeline::from_vec(vec![Expression {
|
||||
expr: Expr::Call(call),
|
||||
span: call_span,
|
||||
ty: Type::Any,
|
||||
custom_completion: None,
|
||||
}]);
|
||||
}
|
||||
|
||||
match cmd.name() {
|
||||
"overlay hide" => parse_overlay_hide(working_set, call),
|
||||
|
|
|
@ -1312,3 +1312,13 @@ fn alias_overlay_new() {
|
|||
assert_eq!(actual.out, "eggs");
|
||||
assert_eq!(actual_repl.out, "eggs");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlay_help_no_error() {
|
||||
let actual = nu!(cwd: ".", "overlay hide -h");
|
||||
assert!(actual.err.is_empty());
|
||||
let actual = nu!(cwd: ".", "overlay new -h");
|
||||
assert!(actual.err.is_empty());
|
||||
let actual = nu!(cwd: ".", "overlay use -h");
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue