diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 01:14:32 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 01:14:32 +0200 |
commit | a7a62352c46b5d2b37baaa09f8145b1171ca79fb (patch) | |
tree | 681d65114e9db978010e969a08ca18173e93f39d /app | |
parent | 3fc4ff425546670c979b8bc62e7debe5b5c1a77a (diff) | |
download | app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.gz app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.bz2 app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.xz app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.zip |
o Consistent output when the method is missing.
Diffstat (limited to 'app')
-rwxr-xr-x | app | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -13,6 +13,11 @@ mkdir -p $BASEDIR/.app/var/pid mkdir -p $BASEDIR/.app/var/download method_usage() { + if [ -n "$1" ] + then + echo "Error:" "$@" >&2 + fi + echo "usage: $0 [-n name] [-i instance] <method group>" >&2 echo "" >&2 echo "Available method groups:" >&2 @@ -78,9 +83,9 @@ main() { esac done + local method=$1 if [ $# -gt 0 ] then - method=$1 shift fi @@ -88,7 +93,14 @@ main() { app) method_app "$name" "$instance" "$@" ;; conf) method_conf "$name" "$instance" "$@" ;; operate) method_operate "$name" "$instance" "$@" ;; - *) method_usage ;; + *) + if [ -z "$method" ] + then + method_usage + else + method_usage "No such method group: $method" + fi + ;; esac exit $? } |