opt_hooks.sh: Add checks for invalid --color and --paging

This commit is contained in:
Ethan P 2020-04-01 12:59:30 -07:00
parent f8d6dc83f3
commit 94ca32b0db
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA

View File

@ -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
} ;; } ;;