mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-01 10:11:14 -03:00
This fixes "man abbr" on macOS and FreeBSD.
Upstream feature request:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290911
Note that this workarond requires another one, copied from ec939fb22f
(Work around BSD man calling pager when stdout is not a TTY,
2024-10-30).
Closes #12037
23 lines
935 B
Fish
23 lines
935 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 MANPAGER=cat WHATISPAGER=cat 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
|