mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-29 00:21:14 -03:00
Also, remove a macOS version check that's doom to obsolescence, and extract a function (WIP).
23 lines
930 B
Fish
23 lines
930 B
Fish
# localization: skip(private)
|
|
function __fish_print_help --description "Print help for the specified fish function or builtin"
|
|
set -l item (__fish_canonicalize_builtin $argv[1])
|
|
|
|
function __fish_print_help_man -V item -a man1
|
|
if not path is $man1
|
|
# Trigger the "documentation not be installed" message. Currently
|
|
# only when called from core.
|
|
return 2
|
|
end
|
|
set -l args -l (path filter -- $man1/$item.1 $man1/$item.1.gz)[1]
|
|
# Work around macOS/FreeBSD man not supporting -l yet (only mandoc really needs it).
|
|
if not __fish_without_manpager command man -l $args[2] &>/dev/null
|
|
set -e args[1]
|
|
end
|
|
command man $args
|
|
end
|
|
__fish_data_with_directory man/man1 \
|
|
"$(string escape --style=regex $item.1)(?:\.gz)?" \
|
|
__fish_print_help_man
|
|
__fish_with_status functions --erase __fish_print_help_man
|
|
end
|