@matheusbsbs / matheus-bagliano / commits / 1d5bec8b9c
Fork 0

git submodule: Cleanup usage string and add option parsing to cmd_foreach()

Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johan Herland committed Aug 19, 2009 at 03:45 UTC 1d5bec8b9cee65b1f98a118ba79120ea686252e3
1 file changed +25 -3
git-submodule.sh
+25 -3
@@ -4,9 +4,14 @@
4 #
5 # Copyright (c) 2007 Lars Hjemli
6
7 -USAGE="[--quiet] [--cached] \
8 -[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit <n>] [<commit>]] \
9 -[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
7 +dashless=$(basename "$0" | sed -e 's/-/ /')
8 +USAGE="[--quiet] add [-b branch] [--reference <repository>] [--] <repository> <path>
9 + or: $dashless [--quiet] status [--cached] [--] [<path>...]
10 + or: $dashless [--quiet] init [--] [<path>...]
11 + or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--] [<path>...]
12 + or: $dashless [--quiet] summary [--cached] [--summary-limit <n>] [commit] [--] [<path>...]
13 + or: $dashless [--quiet] foreach <command>
14 + or: $dashless [--quiet] sync [--] [<path>...]"
15 OPTIONS_SPEC=
16 . git-sh-setup
17 . git-parse-remote
@@ -237,6 +242,23 @@ cmd_add()
242 #
243 cmd_foreach()
244 {
245 + # parse $args after "submodule ... foreach".
246 + while test $# -ne 0
247 + do
248 + case "$1" in
249 + -q|--quiet)
250 + GIT_QUIET=1
251 + ;;
252 + -*)
253 + usage
254 + ;;
255 + *)
256 + break
257 + ;;
258 + esac
259 + shift
260 + done
261 +
262 module_list |
263 while read mode sha1 stage path
264 do