From: "Imran M Yousuf" <imyousuf@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, "Imran M Yousuf" <imyousuf@smartitengineering.com>
Subject: Re: [PATCH] git-submodule.sh: Add pre command argument to git submodule recurse subcommand
Date: Mon, 5 May 2008 15:07:42 +0600 [thread overview]
Message-ID: <7bfdc29a0805050207n6d2f8122kbb58d8e5389d90eb@mail.gmail.com> (raw)
In-Reply-To: <1209977051-25896-4-git-send-email-imyousuf@gmail.com>
Sorry for the inconvenience, but please ignore this patch as it was
not generated with -n and version number :(.
- best regards,
Imran
On Mon, May 5, 2008 at 2:44 PM, <imyousuf@gmail.com> wrote:
> From: Imran M Yousuf <imyousuf@smartitengineering.com>
>
> I usually feel that when typing a command, being able to see some options
> come in handy. For example if I can see the available branches before checking
> out a branch that would be useful, IOW, if I could do 'git branch' before git
> checkout it would be helpful.
>
> It is now possible using the [-p|--pre-command] option. Using this
> subcommand command argument one can actually execute another command before
> specifying the arguments or the original command getting executed.
>
> git submodule recurse -a -p checkout
>
> it will prompt the user for the pre command until one is satisfied and later
> the original command with the custom argument will get executed.
>
> Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com>
> ---
> git-submodule.sh | 29 ++++++++++++++++++++++++++++-
> 1 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 314652d..dd80850 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -12,7 +12,7 @@ LONG_USAGE="$0 add [-q|--quiet] [-b|--branch branch] <repository> [<path>]
> $0 [status] [-q|--quiet] [-c|--cached] [--] [<path>...]
> $0 init|update [-q|--quiet] [--] [<path>...]
> $0 summary [--cached] [-n|--summary-limit <n>] [<commit>]
> -$0 recurse [-q|--quiet] [-e|--exit-after-error] [-d|--depth <recursion depth>] [-b|--breadth-first] [-a|--customized-argument] <git command> [<args> ...]"
> +$0 recurse [-q|--quiet] [-e|--exit-after-error] [-d|--depth <recursion depth>] [-b|--breadth-first] [-a|--customized-argument] [-p|--pre-command] <git command> [<args> ...]"
> OPTIONS_SPEC=
> . git-sh-setup
> require_work_tree
> @@ -27,6 +27,7 @@ depth_first=1
> on_error=
> use_custom_args=
> custom_args=
> +pre_cmd=
>
> #
> # print stuff on stdout unless -q was specified
> @@ -587,6 +588,28 @@ cmd_status()
> done
> }
>
> +# Take command from user and execute it until user wants to discontinue
> +do_pre_command()
> +{
> + say "Starting pre-comamnd execution!"
> + while :
> + do
> + (
> + printf "Please provide a command: "
> + read pre_command
> + test -z "$pre_command" ||
> + eval "$pre_command"
> + )
> + printf "Press y to continue with another shell command... "
> + read keypress
> + if test "$keypress" != "y" &&
> + test "$keypress" != "Y"
> + then
> + break
> + fi
> + done
> +}
> +
> # Take arguments from user to pass as custom arguments and execute the command
> exec_with_custom_args()
> {
> @@ -673,6 +696,7 @@ traverse_module()
> # If depth-first is specified in that case submodules are
> # are traversed before executing the command on this submodule
> test -n "$depth_first" && traverse_submodules "$@"
> + test -n "$pre_cmd" && do_pre_command
> say "git submodule recurse $submod_path $*"
> if test -n "$use_custom_args"
> then
> @@ -734,6 +758,9 @@ cmd_recurse() {
> -a|--customized-argument)
> use_custom_args=1
> ;;
> + -p|--pre-command)
> + pre_cmd=1
> + ;;
> -*)
> usage
> ;;
> --
> 1.5.4.2
>
>
--
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran@smartitengineering.com
Mobile: +880-1711402557
next prev parent reply other threads:[~2008-05-05 9:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-05 8:44 [PATCH] git-submodule.sh: Add Long Usage instead of simple usage imyousuf
2008-05-05 8:44 ` [PATCH] git-submodule.sh: Add recurse subcommand with basic options imyousuf
2008-05-05 8:44 ` [PATCH] git-submodule.sh: Add Custom argument input support to git submodule recurse subcommand imyousuf
2008-05-05 8:44 ` [PATCH] git-submodule.sh: Add pre command argument " imyousuf
2008-05-05 8:44 ` [PATCH] Documentation/git-submodule.txt: Add documentation for the " imyousuf
2008-05-05 9:07 ` Imran M Yousuf
2008-05-05 9:07 ` Imran M Yousuf [this message]
2008-05-05 9:07 ` [PATCH] git-submodule.sh: Add Custom argument input support to git submodule " Imran M Yousuf
2008-05-05 9:08 ` [PATCH] git-submodule.sh: Add recurse subcommand with basic options Imran M Yousuf
2008-05-05 9:07 ` [PATCH] git-submodule.sh: Add Long Usage instead of simple usage Imran M Yousuf
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=7bfdc29a0805050207n6d2f8122kbb58d8e5389d90eb@mail.gmail.com \
--to=imyousuf@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=imyousuf@smartitengineering.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).