From 1d5bec8b9cee65b1f98a118ba79120ea686252e3 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 19 Aug 2009 03:45:19 +0200 Subject: [PATCH] git submodule: Cleanup usage string and add option parsing to cmd_foreach() Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- git-submodule.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index d8ecdb91fe..f48f682ab6 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