lib: Fix issue when pagers read an empty argument as a file

This commit is contained in:
Ethan P 2020-05-01 23:03:59 -07:00
parent d29915f141
commit 20a0058014
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA

View File

@ -36,14 +36,12 @@ pager_version() {
# Example:
# pager_exec echo hi
pager_exec() {
if [[ -n "$1" ]]; then
if [[ -n "$SCRIPT_PAGER_CMD" ]]; then
"$@" | "${SCRIPT_PAGER_CMD[@]}" "${SCRIPT_PAGER_ARGS[@]}"
return $?
else
"$@"
return $?
fi
if [[ -n "$SCRIPT_PAGER_CMD" ]]; then
"$@" | pager_display
return $?
else
"$@"
return $?
fi
}
@ -53,7 +51,7 @@ pager_exec() {
# bat | pager_display
pager_display() {
if [[ -n "$SCRIPT_PAGER_CMD" ]]; then
if [[ -n "$SCRIPT_PAGER_CMD" ]]; then
if [[ -n "$SCRIPT_PAGER_ARGS" ]]; then
"${SCRIPT_PAGER_CMD[@]}" "${SCRIPT_PAGER_ARGS[@]}"
return $?
else