summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2009-08-19 01:45:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-19 05:50:30 (GMT)
commit1d5bec8b9cee65b1f98a118ba79120ea686252e3 (patch)
tree02abfddef9d44df74ccc7e8fde15440e6779cac6 /git-submodule.sh
parent1e7f2aad7dd9b0b5ec8bbae2e3015915687e2cd2 (diff)
downloadgit-1d5bec8b9cee65b1f98a118ba79120ea686252e3.zip
git-1d5bec8b9cee65b1f98a118ba79120ea686252e3.tar.gz
git-1d5bec8b9cee65b1f98a118ba79120ea686252e3.tar.bz2
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>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh28
1 files changed, 25 insertions, 3 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index d8ecdb9..f48f682 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -4,9 +4,14 @@
#
# Copyright (c) 2007 Lars Hjemli
-USAGE="[--quiet] [--cached] \
-[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit <n>] [<commit>]] \
-[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
+dashless=$(basename "$0" | sed -e 's/-/ /')
+USAGE="[--quiet] add [-b branch] [--reference <repository>] [--] <repository> <path>
+ or: $dashless [--quiet] status [--cached] [--] [<path>...]
+ or: $dashless [--quiet] init [--] [<path>...]
+ or: $dashless [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--] [<path>...]
+ or: $dashless [--quiet] summary [--cached] [--summary-limit <n>] [commit] [--] [<path>...]
+ or: $dashless [--quiet] foreach <command>
+ or: $dashless [--quiet] sync [--] [<path>...]"
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