From: Johan Herland Date: Wed, 19 Aug 2009 01:45:19 +0000 (+0200) Subject: git submodule: Cleanup usage string and add option parsing to cmd_foreach() X-Git-Tag: v1.6.5-rc0~32^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1d5bec8b9cee65b1f98a118ba79120ea686252e3;p=git.git git submodule: Cleanup usage string and add option parsing to cmd_foreach() Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- diff --git a/git-submodule.sh b/git-submodule.sh index d8ecdb91f..f48f682ab 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -4,9 +4,14 @@ # # Copyright (c) 2007 Lars Hjemli -USAGE="[--quiet] [--cached] \ -[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] [--summary-limit ] [commit] [--] [...] + or: $dashless [--quiet] foreach + or: $dashless [--quiet] sync [--] [...]" OPTIONS_SPEC= . git-sh-setup . git-parse-remote @@ -237,6 +242,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