From: Eric Sunshine Date: Thu, 17 Oct 2019 17:52:27 GMT Subject: Re: [PATCH 3/6] completion: return the index of found word from __git_find_on_cmdline() Message-ID: In-Reply-To: <20191017173501.3198-4-szeder.dev@gmail.com> On Thu, Oct 17, 2019 at 1:35 PM SZEDER Gábor wrote: > When using the __git_find_on_cmdline() helper function so far we've > only been interested in which one of a set of words appear on the > command line. To complete options for some of 'git worktree's > subcommands in the following patches we'll need not only that, but the > index of that word on the command line as well. > > Extend __git_find_on_cmdline() to optionally show the index of the > found word on the command line (IOW in the $words array) when the > '--show-idx' option is given. > > Signed-off-by: SZEDER Gábor > --- > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > @@ -1069,18 +1069,32 @@ __git_aliased_command () > # Check whether one of the given words is present on the command line, > # and print the first word found. > +# > +# Usage: __git_find_on_cmdline [