git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: SZEDER GáborNext: Denton Liu
Message 6 of 18 in “git-completion.bash: fixes on top of 'dl/complete-stash'”
  1. 0/5 git-completion.bash: fixes on top of 'dl/complete-stash'Denton Liu, Apr 20, 2021
  2. 1/5 git-completion.bash: separate some commands onto their own lineDenton Liu, Apr 20, 2021
  3. 2/5 git-completion.bash: rename to $__git_cmd_idxDenton Liu, Apr 20, 2021
  4. Junio C HamanoApr 20, 2021
  5. SZEDER GáborApr 20, 2021
  6. Junio C HamanoApr 20, 2021
  7. 3/5 git-completion.bash: use $__git_cmd_idx in more placesDenton Liu, Apr 20, 2021
  8. 4/5 git-completion.bash: consolidate cases in _git_stash()Denton Liu, Apr 20, 2021
  9. Ævar Arnfjörð BjarmasonApr 20, 2021
  10. Denton LiuApr 21, 2021
  11. 5/5 git-completion.bash: consolidate no-subcommand case for _git_stash()Denton Liu, Apr 20, 2021
  12. Junio C HamanoApr 20, 2021
  13. Denton LiuApr 21, 2021
  14. 0/4 git-completion.bash: fixes on top of 'dl/complete-stash'Denton Liu, Apr 22, 2021
  15. 1/4 git-completion.bash: separate some commands onto their own lineDenton Liu, Apr 22, 2021
  16. 2/4 git-completion.bash: rename to $__git_cmd_idxDenton Liu, Apr 22, 2021
  17. 4/4 git-completion.bash: consolidate cases in _git_stash()Denton Liu, Apr 22, 2021
  18. 3/4 git-completion.bash: use $__git_cmd_idx in more placesDenton Liu, Apr 22, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.