From: Per Cederqvist Date: Tue, 24 Aug 2010 18:32:38 +0000 (+0200) Subject: Don't implement the usage message of tg depend more than once X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=1b5ad09b5bf411f83c0e20ed5cf6ac02f06b940f;p=topgit.git Don't implement the usage message of tg depend more than once The implmentation of "tg depend" had the usage message in two places. Fixed by creating a usage function, so that there is a single place to edit if the usage changes. Signed-off-by: Per Cederqvist Signed-off-by: Uwe Kleine-König --- diff --git a/tg-depend.sh b/tg-depend.sh index e1a6f17..43d8321 100644 --- a/tg-depend.sh +++ b/tg-depend.sh @@ -6,13 +6,18 @@ name= +usage() +{ + echo "Usage: tg [...] depend add NAME" >&2 + exit 1 +} + ## Parse options subcmd="$1"; shift || : case "$subcmd" in -h|"") - echo "Usage: tg [...] depend add NAME" >&2 - exit 1;; + usage;; add) ;; *) @@ -23,8 +28,7 @@ while [ -n "$1" ]; do arg="$1"; shift case "$arg" in -*) - echo "Usage: tg [...] depend add NAME" >&2 - exit 1;; + usage;; *) [ -z "$name" ] || die "name already specified ($name)" name="$arg";;