From b9e339caf8309f99a10a39a9387c3d8bc9b8aeec Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 25 Mar 2021 21:41:04 +0100 Subject: [PATCH] Move some code in the shell command to a switch-case statement. --- scripts/ybcon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/ybcon b/scripts/ybcon index f9f938c..117012d 100755 --- a/scripts/ybcon +++ b/scripts/ybcon @@ -38,12 +38,7 @@ newArgs() { if [ "$#" != 0 ]; then if [ "$#" = 1 ]; then - if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - usage true - exit 0; - elif [ "$1" = "-p" ] || [ "$1" = "--printresult" ]; then - usage false; exit 0; - elif [ "$1" = "--version" ]; then + if [ "$1" = "--version" ]; then run=true args="$1" skipArgsIteration=true; @@ -54,10 +49,14 @@ if [ "$#" != 0 ]; then do case "$it" in -h | --help | --version ) - usageExit ;; + if [ "$#" = 1 ]; then usageExit; else + usage true; exit 0; + fi ;; -p | --printresult | --target=* ) if test "${args#*$it}" = "$args"; then - newArgs "$it" + if [ "$#" = 1 ]; then usage false; exit 0; else + newArgs "$it" + fi else usageExit fi ;;