diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish index 352070d6d..a4888898f 100644 --- a/share/functions/__fish_print_help.fish +++ b/share/functions/__fish_print_help.fish @@ -1,5 +1,7 @@ function __fish_print_help --description "Print help message for the specified fish function or builtin" --argument-names item error_message switch $item + case ! + set item not case . set item source case : diff --git a/share/functions/help.fish b/share/functions/help.fish index 361e31b84..ff61143a2 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -129,6 +129,8 @@ function help --description 'Show help for the fish shell' set -l fish_help_page switch "$fish_help_item" + case "!" + set fish_help_page "cmds/not.html" case "." set fish_help_page "cmds/source.html" case ":" diff --git a/src/builtins/shared.rs b/src/builtins/shared.rs index 213b815f7..f80935333 100644 --- a/src/builtins/shared.rs +++ b/src/builtins/shared.rs @@ -113,6 +113,10 @@ struct BuiltinData { // Functions that are bound to builtin_generic are handled directly by the parser. // NOTE: These must be kept in sorted order! const BUILTIN_DATAS: &[BuiltinData] = &[ + BuiltinData { + name: L!("!"), + func: builtin_generic, + }, BuiltinData { name: L!("."), func: source::source, @@ -471,6 +475,7 @@ pub fn builtin_get_names() -> impl Iterator { /// Return a one-line description of the specified builtin. pub fn builtin_get_desc(name: &wstr) -> Option<&'static wstr> { let desc = match name { + _ if name == "!" => wgettext!("Negate exit status of job"), _ if name == "." => wgettext!("Evaluate contents of file"), _ if name == ":" => wgettext!("Return a successful result"), _ if name == "[" => wgettext!("Test a condition"), // ] diff --git a/tests/checks/not.fish b/tests/checks/not.fish index 77a03c419..111e434f8 100644 --- a/tests/checks/not.fish +++ b/tests/checks/not.fish @@ -8,3 +8,14 @@ echo $status not not sh -c 'exit 34' echo $status # CHECK: 34 + +! -h +# CHECKERR: fish: !: missing man page +# CHECKERR: Documentation may not be installed. +# CHECKERR: `help !` will show an online version + +function ! + echo overridden! $argv +end +! -h +# CHECK: overridden! -h