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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 9, 2018 at 5:20 AM, Aaron Schrab <aaron@xxxxxxxxxx> wrote:
> At 17:24 +0200 08 May 2018, Duy Nguyen <pclouds@xxxxxxxxx> 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.

>
> 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.

>
> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux