Shorten the ybcon shell command script.

This commit is contained in:
Username404-59 2021-03-26 12:55:33 +01:00
parent c933c7e86e
commit c087d8b2f0
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1

View File

@ -23,11 +23,10 @@ usage() {
usageExit() {
usage false
exit 0
}
}; helpExit() { usage true; exit 0; }
args="";
run=false;
skipArgsIteration=false;
newArgs() {
if [ "$args" = "" ]; then
@ -39,35 +38,33 @@ newArgs() {
if [ "$#" != 0 ]; then
if [ "$#" = 1 ]; then
if [ "$1" = "--version" ]; then
run=true
args="$1"
skipArgsIteration=true;
fi
fi
if [ "$skipArgsIteration" = false ]; then
case "$1" in
-h | --help )
helpExit ;;
--version )
run=true; args="$1" ;;
*.ybcon )
newArgs "$1"; run=true ;;
* )
usageExit ;;
esac
else
for it in "$@"
do
case "$it" in
-h | --help | --version )
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
do
case "$it" in
-p | --printresult | --target=* )
if test "${args#*$it}" = "$args"; then
newArgs "$it"
fi
else
usageExit
fi ;;
*.ybcon )
newArgs "$it"
run=true ;;
* )
usageExit ;;
esac
done
else
usageExit
fi ;;
*.ybcon )
newArgs "$it"
run=true ;;
* )
usageExit ;;
esac
done
fi
else
usage false
@ -76,7 +73,7 @@ fi
runIt() { eval "$1" " $args"; }
if [ "$run" = true ]; then
if [ -f $defaultBinLocation ]; then
if [ -f "$defaultBinLocation" ]; then
runIt "$defaultBinLocation"
elif [ -f ybcon ]; then
runIt "./ybcon"