mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 09:53:43 +01:00
Reorder help <keyword>
priority (#7929)
# Description `help <keyword>` will now search for `<keyword>` in aliases first, then commands. This matches the way the parser resolves aliases before commands. # User-Facing Changes Not significant
This commit is contained in:
parent
aef88aa03e
commit
e8d930f659
@ -86,15 +86,15 @@ You can also learn more at https://www.nushell.sh/book/"#;
|
||||
} else if find.is_some() {
|
||||
help_commands(engine_state, stack, call)
|
||||
} else {
|
||||
let result = help_commands(engine_state, stack, call);
|
||||
let result = help_aliases(engine_state, stack, call);
|
||||
|
||||
let result = if let Err(ShellError::CommandNotFound(_)) = result {
|
||||
help_aliases(engine_state, stack, call)
|
||||
let result = if let Err(ShellError::AliasNotFound(_)) = result {
|
||||
help_commands(engine_state, stack, call)
|
||||
} else {
|
||||
result
|
||||
};
|
||||
|
||||
let result = if let Err(ShellError::AliasNotFound(_)) = result {
|
||||
let result = if let Err(ShellError::CommandNotFound(_)) = result {
|
||||
help_modules(engine_state, stack, call)
|
||||
} else {
|
||||
result
|
||||
|
@ -342,3 +342,15 @@ fn help_modules_main_2() {
|
||||
|
||||
assert_eq!(actual.out, "spam");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_alias_before_command() {
|
||||
let code = &[
|
||||
"alias SPAM = print 'spam'",
|
||||
"def SPAM [] { 'spam' }",
|
||||
"help SPAM",
|
||||
];
|
||||
let actual = nu!(cwd: ".", nu_repl_code(code));
|
||||
|
||||
assert!(actual.out.contains("Alias"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user