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