forked from extern/nushell
Fix overlay's help message lead to internal error (#9087)
This commit is contained in:
parent
a7c1b363eb
commit
345cdef113
@ -102,6 +102,16 @@ pub fn parse_keyword(
|
|||||||
{
|
{
|
||||||
// Apply parse keyword side effects
|
// Apply parse keyword side effects
|
||||||
let cmd = working_set.get_decl(call.decl_id);
|
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() {
|
match cmd.name() {
|
||||||
"overlay hide" => parse_overlay_hide(working_set, call),
|
"overlay hide" => parse_overlay_hide(working_set, call),
|
||||||
|
@ -1312,3 +1312,13 @@ fn alias_overlay_new() {
|
|||||||
assert_eq!(actual.out, "eggs");
|
assert_eq!(actual.out, "eggs");
|
||||||
assert_eq!(actual_repl.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 New Issue
Block a user