mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 16:21:15 -03:00
functions/__fish_print_help: work around for FreeBSD's man missing -l
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
This commit is contained in:
@@ -8,9 +8,12 @@ function __fish_print_help --description "Print help for the specified fish func
|
||||
# only when called from core.
|
||||
return 2
|
||||
end
|
||||
set -l file (path filter -- $man1/$item.1 $man1/$item.1.gz)
|
||||
# "-l" to read a local file, required for mandoc
|
||||
command man -l $file[1]
|
||||
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)?" \
|
||||
|
||||
Reference in New Issue
Block a user