git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Johan Herland <johan@herland.net>,
	gitster@pobox.com, mlevedahl@gmail.com, hjemli@gmail.com
Subject: [RFC/PATCH 1/6] git submodule: Cleanup usage string and add option parsing to cmd_foreach()
Date: Wed, 19 Aug 2009 03:45:19 +0200	[thread overview]
Message-ID: <1250646324-961-2-git-send-email-johan@herland.net> (raw)
In-Reply-To: <1250646324-961-1-git-send-email-johan@herland.net>

Signed-off-by: Johan Herland <johan@herland.net>
---
 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] <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|--files] [--summary-limit <n>] [commit] [--] [<path>...]
+   or: $dashless [--quiet] foreach <command>
+   or: $dashless [--quiet] sync [--] [<path>...]"
 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

  reply	other threads:[~2009-08-19  1:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  1:45 [RFC/PATCH 0/6] Git submodule: 'foreach' enhancements and nested submodule handling Johan Herland
2009-08-19  1:45 ` Johan Herland [this message]
2009-08-19  1:45 ` [RFC/PATCH 2/6] Add selftest for 'git submodule foreach' Johan Herland
2009-08-19  1:45 ` [RFC/PATCH 3/6] git submodule foreach: Provide access to submodule name, as '$name' Johan Herland
2009-08-19  1:45 ` [RFC/PATCH 4/6] git submodule foreach: Add --recursive to recurse into nested submodules Johan Herland
2009-08-19  1:45 ` [RFC/PATCH 5/6] git submodule update: Introduce --recursive to update " Johan Herland
2009-08-19  1:45 ` [RFC/PATCH 6/6] git submodule status: Add --recursive to recurse into " Johan Herland
2009-08-19 23:07 ` [RFC/PATCH 7/6] git clone: Add --recursive to automatically checkout (nested) submodules Johan Herland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250646324-961-2-git-send-email-johan@herland.net \
    --to=johan@herland.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hjemli@gmail.com \
    --cc=mlevedahl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).