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

Re: [PATCH/RFC] completion: complete all possible -no-<options>

From
Duy Nguyen <pclouds@gmail.com>
Date
May 14, 2018, 17:14 UTC
Message-ID
<CACsJy8BPPbaoecp_xecG2_Sa0eFKwxs60JJooQZoo9Wpo59wHw@mail.gmail.com>
In-Reply-To
<20180509032050.GA23510@pug.qqx.org>
On Wed, May 9, 2018 at 5:20 AM, Aaron Schrab <aaron@schrab.com> wrote:
Show 13 quoted lines
> At 17:24 +0200 08 May 2018, Duy Nguyen <pclouds@gmail.com> wrote:
>>
>> It took me so long to reply partly because I remember seeing some guy
>> doing clever trick with tab completion that also shows a short help
>> text in addition to the complete words. I could not find that again
>> and from my reading (also internet searching) it's probably not
>> possible to do this without trickery.
>
>
> Was that perhaps using zsh rather than bash? Below is some of the display
> from its git completion (this is likely affected somewhat by my
> configuration).  The group descriptions (lines that begin with "Completing")
> appear in a different color, and are not available for selection.
Ah. That's probably it.
Show 26 quoted lines
>
> 1113$ git c<tab>
> Completing alias
> ci               -- alias for 'commit -v'
> cia              -- alias for 'commit -v -a'
> co               -- alias for 'checkout'
> conf             -- alias for 'config'
> Completing main porcelain command
> checkout         -- checkout branch or paths to working tree
> cherry-pick      -- apply changes introduced by some existing commits
> citool           -- graphical alternative to git commit
> clean            -- remove untracked files from working tree
> clone            -- clone repository into new directory
> commit           -- record changes to repository
> Completing ancillary manipulator command
> config           -- get and set repository or global options
> Completing ancillary interrogator command
> cherry           -- find commits not merged upstream
> count-objects    -- count unpacked objects and display their disk
> consumption
> Completing plumbing manipulator command
> checkout-index   -- copy files from index to working directory
> commit-tree      -- create new commit object
> Completing plumbing interrogator command
> cat-file         -- provide content or type information for repository
> objects

It's interesting that zsh could do this. I looked at the script and these texts are hard coded in there. I don't use zsh myself and won't be doing this, but this information should be now available from git binary so you can lower maintenance cost for the zsh completion script.

Show 10 quoted lines
>
> 1114$ git commit -<tab>
> Completing option
> --all                  -a       -- stage all modified and deleted paths
> --allow-empty                   -- allow recording an empty commit
> --allow-empty-message           -- allow recording a commit with an empty
> message
> --amend                         -- amend the tip of the current branch
> --author                        -- override the author name used in the
> commit

Hm.. no idea where this is from. Maybe zsh can extract "git <command> -h"? Anyway it does not matter.

-- 
Duy
Previous: Aaron SchrabNext: Eric Sunshine
Message 8 of 23 in “completion: complete all possible -no-<options>”
  1. completion: complete all possible -no-<options>Nguyễn Thái Ngọc Duy, Apr 17, 2018
  2. Junio C HamanoApr 18, 2018
  3. Duy NguyenApr 18, 2018
  4. Eric SunshineApr 23, 2018
  5. Duy NguyenMay 8, 2018
  6. Stefan BellerMay 8, 2018
  7. Aaron SchrabMay 9, 2018
  8. Duy NguyenMay 14, 2018
  9. Eric SunshineMay 14, 2018
  10. Duy NguyenMay 14, 2018
  11. Andreas HeidukMay 14, 2018
  12. Duy NguyenMay 14, 2018
  13. Andreas HeidukMay 14, 2018
  14. 0/3 completion: complete all possible -no-<options>Nguyễn Thái Ngọc Duy, May 27, 2018
  15. 1/3 parse-options: option to let --git-completion-helper show negative formNguyễn Thái Ngọc Duy, May 27, 2018
  16. 3/3 completion: collapse extra --no-.. optionsNguyễn Thái Ngọc Duy, May 27, 2018
  17. Stefan BellerMay 29, 2018
  18. Duy NguyenMay 29, 2018
  19. 2/3 completion: suppress some -no- optionsNguyễn Thái Ngọc Duy, May 27, 2018
  20. 0/3 ompletion: complete all possible -no-<options>Nguyễn Thái Ngọc Duy, Jun 6, 2018
  21. 2/3 completion: suppress some -no- optionsNguyễn Thái Ngọc Duy, Jun 6, 2018
  22. 1/3 parse-options: option to let --git-completion-helper show negative formNguyễn Thái Ngọc Duy, Jun 6, 2018
  23. 3/3 completion: collapse extra --no-.. optionsNguyễn Thái Ngọc Duy, Jun 6, 2018

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.