mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-20 11:47:43 +02:00
opt_hooks.sh: Add checks for invalid --color and --paging
This commit is contained in:
parent
f8d6dc83f3
commit
94ca32b0db
@ -26,8 +26,11 @@ hook_color() {
|
|||||||
case "$OPT_VAL" in
|
case "$OPT_VAL" in
|
||||||
always | true) OPT_COLOR=true ;;
|
always | true) OPT_COLOR=true ;;
|
||||||
never | false) OPT_COLOR=false ;;
|
never | false) OPT_COLOR=false ;;
|
||||||
|
|
||||||
auto) return 0 ;;
|
auto) return 0 ;;
|
||||||
|
*)
|
||||||
|
printc "%{RED}%s: '--color' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "$PROGRAM"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
} ;;
|
} ;;
|
||||||
|
|
||||||
@ -65,6 +68,10 @@ hook_pager() {
|
|||||||
auto) : ;;
|
auto) : ;;
|
||||||
always) : ;;
|
always) : ;;
|
||||||
never) SCRIPT_PAGER_CMD='' ;;
|
never) SCRIPT_PAGER_CMD='' ;;
|
||||||
|
*)
|
||||||
|
printc "%{RED}%s: '--paging' expects value of 'auto', 'always', or 'never'%{CLEAR}\n" "$PROGRAM"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
} ;;
|
} ;;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user