chiark / gitweb /
Check for help invocation before setup
authormartin f. krafft <madduck@debian.org>
Wed, 19 Nov 2008 14:56:58 +0000 (15:56 +0100)
committermartin f. krafft <madduck@debian.org>
Thu, 20 Nov 2008 09:58:40 +0000 (10:58 +0100)
Signed-off-by: martin f. krafft <madduck@debian.org>
tg.sh

diff --git a/tg.sh b/tg.sh
index 4dcc15eff90bcc581980336b94d44f40e2385759..da3366d533f49702c1c25ab0a7bd9022e3fdf137 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -241,6 +241,19 @@ do_help()
 [ -d "@cmddir@" ] ||
        die "No command directory: '@cmddir@'"
 
 [ -d "@cmddir@" ] ||
        die "No command directory: '@cmddir@'"
 
+args_saved="$@"
+while [ -n "$1" ]; do
+       case "$1" in
+       help|--help|-h)
+               shift
+               do_help "$1"
+               exit 0;;
+       esac
+       shift
+done
+set -- $args_saved
+unset args_saved
+
 ## Initial setup
 
 set -e
 ## Initial setup
 
 set -e
@@ -270,9 +283,6 @@ cmd="$1"
 shift
 
 case "$cmd" in
 shift
 
 case "$cmd" in
-help|--help|-h)
-       do_help "$1"
-       exit 0;;
 --hooks-path)
        # Internal command
        echo "@hooksdir@";;
 --hooks-path)
        # Internal command
        echo "@hooksdir@";;