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 [ "$#" != 0 ]; then
|
||||||
if [ "$#" = 1 ]; then
|
if [ "$#" = 1 ]; then
|
||||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
if [ "$1" = "--version" ]; then
|
||||||
usage true
|
|
||||||
exit 0;
|
|
||||||
elif [ "$1" = "-p" ] || [ "$1" = "--printresult" ]; then
|
|
||||||
usage false; exit 0;
|
|
||||||
elif [ "$1" = "--version" ]; then
|
|
||||||
run=true
|
run=true
|
||||||
args="$1"
|
args="$1"
|
||||||
skipArgsIteration=true;
|
skipArgsIteration=true;
|
||||||
|
@ -54,10 +49,14 @@ if [ "$#" != 0 ]; then
|
||||||
do
|
do
|
||||||
case "$it" in
|
case "$it" in
|
||||||
-h | --help | --version )
|
-h | --help | --version )
|
||||||
usageExit ;;
|
if [ "$#" = 1 ]; then usageExit; else
|
||||||
|
usage true; exit 0;
|
||||||
|
fi ;;
|
||||||
-p | --printresult | --target=* )
|
-p | --printresult | --target=* )
|
||||||
if test "${args#*$it}" = "$args"; then
|
if test "${args#*$it}" = "$args"; then
|
||||||
|
if [ "$#" = 1 ]; then usage false; exit 0; else
|
||||||
newArgs "$it"
|
newArgs "$it"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
usageExit
|
usageExit
|
||||||
fi ;;
|
fi ;;
|
||||||
|
|
Loading…
Reference in New Issue