From a7a62352c46b5d2b37baaa09f8145b1171ca79fb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 14 Oct 2012 01:14:32 +0200 Subject: o Consistent output when the method is missing. --- app | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app b/app index 45adaee..dc70ab0 100755 --- a/app +++ b/app @@ -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] " >&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 $? } -- cgit v1.2.3