Use more(1) as a fallback for paging

pull/134/head
terminalforlife 4 years ago
parent 66a38b7196
commit 1e7c9ae57e

@ -16,7 +16,7 @@ Usage(){
-h, --help - Display this help information.
-D, --no-subdirs - Ignore the 'sheets/_*' subdirectories.
-N, --no-preview - Omit the preview of each triggered line.
-P, --no-pager - Do not use less(1) to page the output.
-P, --no-pager - Do not use less(1) or more(1) for paging.
-S, --no-summary - Omit the summary before $Progrm exits.
-W, --no-whilelist - Do not use the whitelist file.
-c, --colorize - Provide color via esscape sequences.
@ -173,9 +173,18 @@ Main(){
}
if [ -t 1 -a "$NoPager" != 'True' ]; then
# Prefer less(1), but have more(1) as a fallback.
if type -fP less &> /dev/null; then
Pager='less'
elif type -fP more &> /dev/null; then
Pager='more'
else
Err 1 'Neither less(1) nor more(1) were found.'
fi
# Redirecting STDERR to address less(1) bug causing summary to display
# where it shouldn't; only seems to happen when colorization is enabled.
Main 2>&1 | less -r
Main 2>&1 | $Pager -r
else
Main

Loading…
Cancel
Save