mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-13 01:30:58 +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
|
OPT_HIGHLIGHT=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Handle the --search-pattern option.
|
||||||
if [[ "$OPT_SEARCH_PATTERN" ]]; then
|
if [[ "$OPT_SEARCH_PATTERN" ]]; then
|
||||||
if is_pager_less; then
|
if is_pager_less; then
|
||||||
if [[ "$OPT_FIXED_STRINGS" ]]; then
|
if [[ "$OPT_FIXED_STRINGS" ]]; then
|
||||||
@ -150,9 +151,16 @@ if [[ "$OPT_SEARCH_PATTERN" ]]; then
|
|||||||
else
|
else
|
||||||
SCRIPT_PAGER_ARGS+=(-p "$PATTERN")
|
SCRIPT_PAGER_ARGS+=(-p "$PATTERN")
|
||||||
fi
|
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
|
else
|
||||||
print_error "Unsupported pager '$(pager_name)' for option "\
|
print_error "Unsupported pager '%s' for option -p/--search-pattern" \
|
||||||
"-p/--search-pattern"
|
"$(pager_name)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user