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:
Johannes Altmanninger
2025-11-09 10:50:02 +01:00
parent 59658b44a9
commit 8589231742

View File

@@ -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)?" \