[TopGit PATCH] Check for help invocation before setup
- From
- martin f. krafft <madduck@debian.org>
- Date
- Nov 19, 2008, 16:03 UTC
- Message-ID
- <1227110623-4474-2-git-send-email-madduck@debian.org>
- In-Reply-To
- <1227110623-4474-1-git-send-email-madduck@debian.org>
The user ought to be able to call `tg help` from anywhere in the filesystem, not just Git repositories, so the help parsing has to happen before the calls to git git binary.
Debian bug: #501982
Signed-off-by: martin f. krafft <madduck@debian.org> --- tg.sh | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tg.sh b/tg.sh index 2961106..40c4ab7 100644 --- a/tg.sh +++ b/tg.sh @@ -235,6 +235,20 @@ do_help() fi } +## Startup + +args_saved="$@" +while [ -n "$1" ]; do + case "$1" in + help|--help|-h) + shift + do_help "$1" + exit 1;; + esac + shift +done +set -- $args_saved +unset args_saved ## Initial setup @@ -268,9 +282,6 @@ cmd="$1" shift case "$cmd" in -help|--help|-h) - do_help "$1" - exit 1;; --hooks-path) # Internal command echo "@hooksdir@";;
-- 1.6.0.2