mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-12 17:20:40 +01:00
Add message for --search-pattern and no pager
I should probably find a more elegant way to split an error message across multiple lines in the future.
This commit is contained in:
parent
63a9929592
commit
3e9969de76
@ -139,6 +139,7 @@ if [[ "$OPT_CONTEXT_BEFORE" -eq 0 && "$OPT_CONTEXT_AFTER" -eq 0 ]]; then
|
||||
OPT_HIGHLIGHT=false
|
||||
fi
|
||||
|
||||
# Handle the --search-pattern option.
|
||||
if [[ "$OPT_SEARCH_PATTERN" ]]; then
|
||||
if is_pager_less; then
|
||||
if [[ "$OPT_FIXED_STRINGS" ]]; then
|
||||
@ -150,9 +151,16 @@ if [[ "$OPT_SEARCH_PATTERN" ]]; then
|
||||
else
|
||||
SCRIPT_PAGER_ARGS+=(-p "$PATTERN")
|
||||
fi
|
||||
elif [[ -z "$(pager_name)" ]]; then
|
||||
print_error "$(
|
||||
echo "The -p/--search-pattern option requires a pager, but" \
|
||||
"the pager was explicitly disabled by \$BAT_PAGER or the" \
|
||||
"--paging option."
|
||||
)"
|
||||
exit 1
|
||||
else
|
||||
print_error "Unsupported pager '$(pager_name)' for option "\
|
||||
"-p/--search-pattern"
|
||||
print_error "Unsupported pager '%s' for option -p/--search-pattern" \
|
||||
"$(pager_name)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user