Move some code in the shell command to a switch-case statement.

This commit is contained in:
Username404-59 2021-03-25 21:41:04 +01:00
parent 76cd97715f
commit b9e339caf8
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 7 additions and 8 deletions

View File

@ -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
if [ "$#" = 1 ]; then usage false; exit 0; else
newArgs "$it"
fi
else
usageExit
fi ;;