All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wiktor Mis via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Wiktor Mis <mwiktor023@gmail.com>, Wiktor Mis <mwiktor023@gmail.com>
Subject: [PATCH v2] completion: complete "git -<TAB>" with short options
Date: Wed, 26 Nov 2025 16:26:31 +0000	[thread overview]
Message-ID: <pull.2100.v2.git.git.1764174391776.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2100.git.git.1764052739534.gitgitgadget@gmail.com>

From: Wiktor Mis <mwiktor023@gmail.com>

"git" itself has completion for long options and cmds, but not short ones

Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
---
    Add completion for short options

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2100%2FWiktorro%2Fpatch-3-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2100/Wiktorro/patch-3-v2
Pull-Request: https://github.com/git/git/pull/2100

Range-diff vs v1:

 1:  1b15a0b458 ! 1:  e6161ffe3b Add completion for short options
     @@ Metadata
      Author: Wiktor Mis <mwiktor023@gmail.com>
      
       ## Commit message ##
     -    Add completion for short options
     +    completion: complete "git -<TAB>" with short options
      
     -    Git provided completion for long options but not the short ones
     +    "git" itself has completion for long options and cmds, but not short ones
      
          Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
      
       ## contrib/completion/git-completion.bash ##
      @@ contrib/completion/git-completion.bash: __git_main ()
     - 			--help
     - 			"
       			;;
     + 		esac
     + 		case "$cur" in
     +-		--*)
      +		-*)
     -+			__gitcomp "
     + 			__gitcomp "
     + 			--paginate
     + 			--no-pager
     +@@ contrib/completion/git-completion.bash: __git_main ()
     + 			--namespace=
     + 			--no-replace-objects
     + 			--help
      +			-C
      +			-P
      +			-c
      +			-h
      +			-p
      +			-v
     -+			"
     -+			;;
     + 			"
     + 			;;
       		*)
     - 			if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}"
     - 			then


 contrib/completion/git-completion.bash | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 73abea31b4..1705ca3323 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3898,7 +3898,7 @@ __git_main ()
 			;;
 		esac
 		case "$cur" in
-		--*)
+		-*)
 			__gitcomp "
 			--paginate
 			--no-pager
@@ -3914,6 +3914,12 @@ __git_main ()
 			--namespace=
 			--no-replace-objects
 			--help
+			-C
+			-P
+			-c
+			-h
+			-p
+			-v
 			"
 			;;
 		*)

base-commit: fd372d9b1a69a01a676398882bbe3840bf51fe72
-- 
gitgitgadget

  parent reply	other threads:[~2025-11-26 16:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  6:38 [PATCH] Add completion for short options Wiktor Mis via GitGitGadget
2025-11-25 16:42 ` Junio C Hamano
2025-11-26 16:26 ` Wiktor Mis via GitGitGadget [this message]
2025-11-26 20:09   ` [PATCH v2] completion: complete "git -<TAB>" with " Junio C Hamano
2025-11-27  7:33     ` SZEDER Gábor
2025-11-27 21:59       ` Junio C Hamano
2025-12-07  0:38         ` 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=pull.2100.v2.git.git.1764174391776.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mwiktor023@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.