Args: Fix config bug and remove large case for single regex match

This commit is contained in:
Dylan Araps 2016-12-16 10:03:44 +11:00
parent 09de2155f7
commit 70e74768b5

View file

@ -2704,8 +2704,7 @@ color() {
# OTHER # OTHER
err() { err() {
err+="$(color 1)[!]\033[0m $1 err+="$(color 1)[!]\033[0m $1\n"
"
} }
get_script_dir() { get_script_dir() {
@ -3134,17 +3133,7 @@ exit 1
get_args() { get_args() {
# Check the commandline flags early for '--config none/off' # Check the commandline flags early for '--config none/off'
case "$@" in [[ "$@" =~ \-\-config\ ?(off|none) ]] || get_user_config 2>/dev/null
*"--config off"* | *'--config "off"'* | *"--config 'off'"* | \
*"--config none"* | *'--config "none"'* | *"--config 'none'"*)
config="off"
;;
*"--config -"*) ;;
*"--config"*) config="off" ;;
esac
[[ "${config:-on}" == "on" ]] && get_user_config 2>/dev/null
while [[ "$1" ]]; do while [[ "$1" ]]; do
case "$1" in case "$1" in
@ -3291,7 +3280,7 @@ get_args() {
# Other # Other
"--config") "--config")
case "$2" in case "$2" in
"none" | "off") config="off" ;; "none" | "off" | "") config="off" ;;
*) config_file="$2"; config="on"; get_user_config 2>/dev/null ;; *) config_file="$2"; config="on"; get_user_config 2>/dev/null ;;
esac esac
;; ;;