From: Junio C Hamano <gitster@pobox•com>
To: "SZEDER Gábor" <szeder@ira•uka.de>
Cc: Git List <git@vger•kernel.org>, Eric Sunshine <sunshine@sunshineco•com>
Subject: Re: [RFC/PATCH] contrib: teach completion about git-worktree options and arguments
Date: Fri, 21 Aug 2015 10:21:03 -0700 [thread overview]
Message-ID: <xmqq37zc7e2o.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAPig+cQhh7YCiirp4a1+R0bWh46JoFgVOVUCNidTWXK8uNL2Mg@mail.gmail.com> (Eric Sunshine's message of "Thu, 6 Aug 2015 12:29:53 -0400")
Eric Sunshine <sunshine@sunshineco•com> writes:
> On Thu, Jul 23, 2015 at 4:49 PM, Eric Sunshine <sunshine@sunshineco•com> wrote:
>> Complete subcommands 'add' and 'prune', as well as their respective
>> options --force, --detach, --dry-run, --verbose, and --expire. Also
>> complete 'refname' in "git worktree add [-b <newbranch>] <path>
>> <refname>".
>
> Ping[1]?
>
> [1]: http://article.gmane.org/gmane.comp.version-control.git/274526
Ping indeed?
>
>> Signed-off-by: Eric Sunshine <sunshine@sunshineco•com>
>> ---
>>
>> This is RFC since this is my first foray into the Git completion script,
>> and there are likely better and more idiomatic ways to accomplish this.
>>
>> contrib/completion/git-completion.bash | 32 ++++++++++++++++++++++++++++++++
>> 1 file changed, 32 insertions(+)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index c97c648..07c34ef 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -2564,6 +2564,38 @@ _git_whatchanged ()
>> _git_log
>> }
>>
>> +_git_worktree ()
>> +{
>> + local subcommands='add prune'
>> + local subcommand="$(__git_find_on_cmdline "$subcommands")"
>> + local c=2 n=0 refpos=2
>> + if [ -z "$subcommand" ]; then
>> + __gitcomp "$subcommands"
>> + else
>> + case "$subcommand,$cur" in
>> + add,--*)
>> + __gitcomp "--force --detach"
>> + ;;
>> + add,*)
>> + while [ $c -lt $cword ]; do
>> + case "${words[c]}" in
>> + --*) ;;
>> + -[bB]) ((refpos++)) ;;
>> + *) ((n++)) ;;
>> + esac
>> + ((c++))
>> + done
>> + if [ $n -eq $refpos ]; then
>> + __gitcomp_nl "$(__git_refs)"
>> + fi
>> + ;;
>> + prune,--*)
>> + __gitcomp "--dry-run --verbose --expire"
>> + ;;
>> + esac
>> + fi
>> +}
>> +
>> __git_main ()
>> {
>> local i c=1 command __git_dir
>> --
>> 2.5.0.rc3.407.g68aafd0
next prev parent reply other threads:[~2015-08-21 17:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 20:49 [RFC/PATCH] contrib: teach completion about git-worktree options and arguments Eric Sunshine
2015-08-06 16:29 ` Eric Sunshine
2015-08-21 17:21 ` Junio C Hamano [this message]
2015-08-21 20:49 ` SZEDER Gábor
2015-08-21 20:50 ` [PoC PATCH] completion: support 'git worktree' SZEDER Gábor
2015-08-21 21:59 ` [RFC/PATCH] contrib: teach completion about git-worktree options and arguments Eric Sunshine
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=xmqq37zc7e2o.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sunshine@sunshineco$(echo .)com \
--cc=szeder@ira$(echo .)uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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