From 1b5ad09b5bf411f83c0e20ed5cf6ac02f06b940f Mon Sep 17 00:00:00 2001 From: Per Cederqvist Date: Tue, 24 Aug 2010 20:32:38 +0200 Subject: [PATCH] Don't implement the usage message of tg depend more than once MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- tg-depend.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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";; -- 2.30.2