git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: clarify support for short options and arguments
@ 2025-12-07  1:03 Junio C Hamano
  2025-12-07  5:38 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2025-12-07  1:03 UTC (permalink / raw)
  To: git

The list of supported completions in the header of the file was
mostly written a long time ago when Shawn added the initial version
of this script in 2006.  The list explicitly states that we complete
"common --long-options", which implies that we do not complete
not-so-common ones and single letter options (this text dates back
to May 2007).

Update the description to explicitly state that single-letter
options are not completed.  Also, document that arguments to options
are completed, even for single-letter options (e.g., "git -c <TAB>"
offers configuration variables).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
index 73abea31b4..538dff1ee5 100644
--- c/contrib/completion/git-completion.bash
+++ w/contrib/completion/git-completion.bash
@@ -13,7 +13,8 @@
 #    *) git email aliases for git-send-email
 #    *) tree paths within 'ref:path/to/file' expressions
 #    *) file paths within current working directory and index
-#    *) common --long-options
+#    *) common --long-options but not single-letter options
+#    *) arguments to long and single-letter options
 #
 # To use these routines:
 #

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] completion: clarify support for short options and arguments
  2025-12-07  1:03 [PATCH] completion: clarify support for short options and arguments Junio C Hamano
@ 2025-12-07  5:38 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2025-12-07  5:38 UTC (permalink / raw)
  To: git

Junio C Hamano <gitster@pobox.com> writes:

> The list of supported completions in the header of the file was
> mostly written a long time ago when Shawn added the initial version
> of this script in 2006.  The list explicitly states that we complete
> "common --long-options", which implies that we do not complete
> not-so-common ones and single letter options (this text dates back
> to May 2007).
>
> Update the description to explicitly state that single-letter
> options are not completed.  Also, document that arguments to options
> are completed, even for single-letter options (e.g., "git -c <TAB>"
> offers configuration variables).

I appended the following to the end of the proposed commit log
message:

  The reason why we do not complete single-letter options is because
  it does not seem to help all that much to learn that the command
  takes -c, -d, -e options when "git foo -<TAB>" offers these three,
  unlike long options that is easier to guess what they are about.

  Because this rationale is primarily for our developers, let's leave
  it out of the completion script itself, whose messages are entirely
  for end-users.  Our developers can run "git blame" to find this
  commit as needed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-07  5:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-07  1:03 [PATCH] completion: clarify support for short options and arguments Junio C Hamano
2025-12-07  5:38 ` Junio C Hamano

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