Check for less before calling it

This commit is contained in:
Fabian Boehm 2022-10-18 18:05:16 +02:00
parent 410b4c040a
commit f3444bd0cb
2 changed files with 2 additions and 2 deletions

View file

@ -133,7 +133,7 @@ function __fish_print_help --description "Print help message for the specified f
# 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
if test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null
if type -q less; and test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null
set lessopts "$lessopts"X
end

View file

@ -95,7 +95,7 @@ function history --description "display or manipulate interactive command histor
if not set -qx LESS
set -x LESS --quit-if-one-screen
# Also set --no-init for less < v530, see #8157.
if test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null
if type -q less; and test (less --version | string match -r 'less (\d+)')[2] -lt 530 2>/dev/null
set -x LESS $LESS --no-init
end
end