Re: [PATCH 2/5] git-completion.bash: rename to $__git_cmd_idx
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 20, 2021, 22:31 UTC
- Message-ID
- <xmqqo8e837vw.fsf@gitster.g>
- In-Reply-To
- <20210420211432.GA3842406@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 15 quoted lines
> The completion functions for git commands having subcommands usually
> start like this:
>
> _git_remote ()
> {
> local subcommands="
> add rename remove set-head set-branches
> get-url set-url show prune update
> "
> local subcommand="$(__git_find_on_cmdline "$subcommands")"
> if [ -z "$subcommand" ]; then
>
> __git_subcommand_idx holds the index of the word "remote", not the
> index of "add/rename/etc.", so in the context of the completion script
> that name is misleading.OK. As subsubcommands would be a mouthful, calling "stash" etc. as "cmd" would be fine.