git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Hongyi Zhao" <hongyi.zhao@gmail.com>,
	"Philippe Blain" <levraiphilippeblain@gmail.com>,
	"João Victor Bonfim"
	<JoaoVictorBonfim+Git-Mail-List@protonmail.com>
Subject: Re: [PATCH v2 2/2] completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS
Date: Sun, 06 Feb 2022 12:09:35 -0800	[thread overview]
Message-ID: <xmqq8runiwow.fsf@gitster.g> (raw)
In-Reply-To: <20220206133026.GB1936@szeder.dev> ("SZEDER Gábor"'s message of "Sun, 6 Feb 2022 14:30:26 +0100")

SZEDER Gábor <szeder.dev@gmail.com> writes:

> To complete only rarely used plumbing commands in a non-intrusive way,
> in my experience, it's best to first attempt to complete only
> porcelains and aliases, and fall back to complete all commands,
> plumbing included, only when no porcelains match the current word to
> be completed.  E.g.:
>
>   $ git d<TAB>
>   describe   diff   difftool
>   $ git diff-<TAB>
>   diff-files   diff-index   diff-tree

So after getting

    $ git diff<TAB>
    diff difftool

you _have_ to know, if you are not happy with these two, that the
next letter in the name of the command you forgot is a dash, to be
able to say

    $ git diff-<TAB>

which is a bit unfortunate, but I agree that it is much nicer than
getting all the plumbing when trying to complete "git d<TAB>".

I wonder if we can do better, and teach the completion logic an
ability to say this: "I gave 'diff and difftool' after being asked
for 'git diff<TAB>' and then the user is asking the same again
without choosing either. Perhaps I should add less frequent one to
the mix"?

I.e. the end-user session may look like

    $ git diff<TAB>
    diff difftool
    $ git diff<TAB>
    diff difftool diff-files diff-index diff-tree

?

  reply	other threads:[~2022-02-06 20:09 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=xmqq8runiwow.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=JoaoVictorBonfim+Git-Mail-List@protonmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hongyi.zhao@gmail.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=szeder.dev@gmail.com \
    /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.
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 NNTP newsgroup(s).