__fish_print_help: Respect $MANPAGER

Fixes #9488
This commit is contained in:
Fabian Boehm 2023-01-18 17:05:39 +01:00
parent 48db9e6a3f
commit fd8291a96f
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Interactive improvements
- The history pager now uses more screen space, usually half the screen (:issue:`9458`)
- Variables that were set while the locale was C (i.e. ASCII) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`).
- Escape during history search restores the original commandline again (regressed in 3.6.0).
- Using ``--help`` on builtins now respects the $MANPAGER variable in preference to $PAGER (:issue:`9488`).
New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -126,8 +126,12 @@ function __fish_print_help --description "Print help message for the specified f
end | string replace -ra '^ ' '' |
begin
set -l pager less
# Try both PAGER and MANPAGER, last one wins
set -q PAGER
and echo $PAGER | read -at pager
and echo -- $PAGER | read -at pager
set -q MANPAGER
and echo -- $MANPAGER | read -at pager
not isatty stdout
and set pager cat # cannot use a builtin here
# similar to man, but add -F to quit paging when the help output is brief (#6227)