From: Johan Herland Date: Wed, 19 Aug 2009 01:45:19 GMT Subject: [RFC/PATCH 1/6] git submodule: Cleanup usage string and add option parsing to cmd_foreach() Message-ID: <1250646324-961-2-git-send-email-johan@herland.net> In-Reply-To: <1250646324-961-1-git-send-email-johan@herland.net> Signed-off-by: Johan Herland --- git-submodule.sh | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 9bdd6ea..c58eca4 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -4,9 +4,14 @@ # # Copyright (c) 2007 Lars Hjemli -USAGE="[--quiet] [--cached|--files] \ -[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit ] []] \ -[--] [...]|[foreach ]|[sync [--] [...]]" +dashless=$(basename "$0" | sed -e 's/-/ /') +USAGE="[--quiet] add [-b branch] [--reference ] [--] + or: $dashless [--quiet] status [--cached] [--] [...] + or: $dashless [--quiet] init [--] [...] + or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference ] [--merge] [--] [...] + or: $dashless [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...] + or: $dashless [--quiet] foreach + or: $dashless [--quiet] sync [--] [...]" OPTIONS_SPEC= . git-sh-setup . git-parse-remote @@ -238,6 +243,23 @@ cmd_add() # cmd_foreach() { + # parse $args after "submodule ... foreach". + while test $# -ne 0 + do + case "$1" in + -q|--quiet) + GIT_QUIET=1 + ;; + -*) + usage + ;; + *) + break + ;; + esac + shift + done + module_list | while read mode sha1 stage path do -- 1.6.4.304.g1365c.dirty