Move some code in the shell command to a switch-case statement.
This commit is contained in:
parent
76cd97715f
commit
b9e339caf8
|
@ -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 ;;
|
||||
|
|
Loading…
Reference in New Issue