Show the usage only one time in ybcon.sh, in all possible cases.

This commit is contained in:
Username404-59 2021-02-28 13:59:05 +01:00
parent 5c3eb35923
commit ebd42d06b1
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 9 additions and 8 deletions

View File

@ -17,7 +17,11 @@ usage() {
fi
}
pUsed=false
usageExit() {
usage false
exit 0
}
args="";
run=false;
skipArgsIteration=false;
@ -48,21 +52,18 @@ if [ "$#" != 0 ]; then
do
case "$it" in
-h | --help | --version )
usage false
exit 0 ;;
usageExit ;;
-p | --printresult )
if [ $pUsed = false ]; then
pUsed=true
if test "${args#*$it}" = "$args"; then
newArgs "$it"
else
usage false
exit 0
usageExit
fi ;;
*.ybcon )
newArgs "$it"
run=true ;;
* )
usage false ;;
usageExit ;;
esac
done
fi