Re: Some sub-commands can't be completed by TAB key.

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

 



Hi Hongyi,

Le 2022-01-22 à 19:38, Hongyi Zhao a écrit :
> On Sat, Jan 22, 2022 at 10:47 PM Johannes Sixt <j6t@xxxxxxxx> wrote:
>>
>> Am 22.01.22 um 09:42 schrieb Hongyi Zhao:
>>> I find that there are some  sub-commands can't be completed by TAB key:
>>>
>>> $ git <TAB>
>>> add               cherry-pick       fetch             latexdiff
>>> [...]
>>> As you can see, there are some sub-commands which are not listed in
>>> the above list, for example, the following ones:
>>>
>>> $ git ls-remote
>>> $ git ls-files
>>>
>>> Any hints for this problem?
>>
>> Tab completion is only available for user-facing sub-commands
>> ("porcelain"), but not for sub-commands intended for scripting
>> ("plumbing"). The intent is to make tab completion more efficient during
>> day-to-day work on the command line. For example,
> 
> But there are so many git sub-commands, so if the plumbing feature is
> supported, it will facilitate user to check the availability of some
> sub-commands.

If what you want to do is "check the availability" of some sub-command,
you can simply do 'git <subcommand> -h', for example, and see if Git recognizes
the subcommand. 

If you mean discovering Git commands, you can use 'git help -a', which will list
all commands, including pluming commands.

If you want to customize the Bash completion so that some select plumbing 
commands do appear in the tab completion, you can use the config 
'completion.commands' [1]. Setting it to "ls-files ls-remote ls-tree"
would then give you your desired output below.

> 
>>    $ git l<TAB>
>>
>> arrives at
>>
>>    $ git log <cursor here>
> 
> I see the following:
> 
> $ git l<TAB>
> latexdiff   log

This would mean you have a 'git-latexdiff' command somewhere in your PATH.

Hope that helps,

Philippe.

[1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-completioncommands



[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