Shorten the ybcon shell command script.
This commit is contained in:
parent
c933c7e86e
commit
c087d8b2f0
@ -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,25 +38,23 @@ 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
|
||||
newArgs "$it"
|
||||
fi
|
||||
else
|
||||
usageExit
|
||||
fi ;;
|
||||
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user