This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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 <ceder@lysator.liu.se>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information...
cederlys authored and ukleinek committed Aug 24, 2010
1 parent 5aed7e7 commit 1b5ad09b5bf411f83c0e20ed5cf6ac02f06b940f
Showing with 8 additions and 4 deletions.
  1. +8 −4 tg-depend.sh
View
@@ -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";;

0 comments on commit 1b5ad09

Please sign in to comment.