mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 03:21:16 -03:00
Add __fish_anypager helper
This makes it easier to get *any pager* in the number of places we do. Unfortunately: 1. It can't just execute the pager because that might block 2. We can't really set the necessary options for less here so they still need to be set outside. This Fixes #10074 by falling back to `cat` in that case. We could also decide to abort instead of using a non-pager, but for history that's probably fine.
This commit is contained in:
@@ -125,15 +125,10 @@ function __fish_print_help --description "Print help message for the specified f
|
||||
end
|
||||
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
|
||||
set -q MANPAGER
|
||||
and echo -- $MANPAGER | read -at pager
|
||||
set -l pager (__fish_anypager --with-manpager)
|
||||
and isatty stdout
|
||||
or set pager cat # cannot use a builtin here
|
||||
|
||||
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)
|
||||
# Also set -X for less < v530, see #8157.
|
||||
set -l lessopts isRF
|
||||
|
||||
Reference in New Issue
Block a user