git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Hongyi Zhao <hongyi.zhao@gmail.com>, Johannes Sixt <j6t@kdbg.org>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Some sub-commands can't be completed by TAB key.
Date: Sun, 23 Jan 2022 12:31:18 -0500	[thread overview]
Message-ID: <5a30ac1f-d414-0976-cd08-7b059117af41@gmail.com> (raw)
In-Reply-To: <CAGP6PO+GMi6jqRZ5HWxES5GDYkEDHoXOOZ+VvDkm0sC4nxkT4Q@mail.gmail.com>

Hi Hongyi,

Le 2022-01-22 à 19:38, Hongyi Zhao a écrit :
> On Sat, Jan 22, 2022 at 10:47 PM Johannes Sixt <j6t@kdbg.org> 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

  reply	other threads:[~2022-01-23 17:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22  8:42 Some sub-commands can't be completed by TAB key Hongyi Zhao
2022-01-22 14:47 ` Johannes Sixt
2022-01-23  0:38   ` Hongyi Zhao
2022-01-23 17:31     ` Philippe Blain [this message]
2022-01-23 19:51       ` Junio C Hamano
2022-01-24  1:42         ` Hongyi Zhao
2022-01-24  9:18         ` João Victor Bonfim
2022-01-25  7:33           ` Junio C Hamano
2022-01-25 12:49 ` [PATCH] completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS Ævar Arnfjörð Bjarmason
2022-01-26 22:34   ` Junio C Hamano
2022-02-02 11:15   ` [PATCH v2 0/2] " Ævar Arnfjörð Bjarmason
2022-02-02 11:15     ` [PATCH v2 1/2] completion tests: re-source git-completion.bash in a subshell Ævar Arnfjörð Bjarmason
2022-02-02 11:15     ` [PATCH v2 2/2] completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS Ævar Arnfjörð Bjarmason
2022-02-06 13:30       ` SZEDER Gábor
2022-02-06 20:09         ` Junio C Hamano
2022-02-06 22:47           ` SZEDER Gábor
2022-02-07  7:03             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a30ac1f-d414-0976-cd08-7b059117af41@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hongyi.zhao@gmail.com \
    --cc=j6t@kdbg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).