Show the command's usage when no arguments are provided.

This commit is contained in:
Username404-59 2021-02-25 18:51:03 +01:00
parent 69a50e1e79
commit 0049899c86
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 22 additions and 18 deletions

View File

@ -24,24 +24,28 @@ newArgs() {
fi fi
} }
for it in "$@" if [ "$#" != 0 ]; then
do for it in "$@"
case "$it" in do
-h | --help ) case "$it" in
echo "Usage:" -h | --help )
usage echo "Usage:"
exit 0 ;; usage
-p | -printresult ) exit 0 ;;
newArgs "$it" -p | -printresult )
shift ;; newArgs "$it"
*.ybcon ) shift ;;
newArgs "$it" *.ybcon )
run=true newArgs "$it"
break ;; run=true
* ) break ;;
usage ;; * )
esac usage ;;
done esac
done
else
usage
fi
runIt() { eval "$1" " $args"; } runIt() { eval "$1" " $args"; }