git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] bash: Add long option completion for 'git send-email'

From
TLTeemu Likonen <tlikonen@iki.fi>
Date
Apr 27, 2008, 05:09 UTC
Message-ID
<20080427050951.GA3946@mithlond.arda.local>
In-Reply-To
<7vskx8kvbu.fsf@gitster.siamese.dyndns.org>
Add the following long options to be completed with 'git send-email':
  --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run
  --envelope-sender --from --identity --in-reply-to --no-chain-reply-to
  --no-signed-off-by-cc --no-suppress-from --no-thread --quiet
  --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port
  --smtp-ssl --smtp-user --subject --suppress-cc --suppress-from
  --thread --to

Short ones like --to and --cc are not usable for actual completion because of the shortness itself and because there are longer ones which start with same letters (--thread, --compose). It's still useful to have these shorter options _listed_ when user presses TAB key after typing two dashes. It gives user an idea what options are available (and --to and --cc are probably the most commonly used).

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
---
 contrib/completion/git-completion.bash |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 665a895..a9a7015 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -875,6 +875,24 @@ _git_rebase ()
 	__gitcomp "$(__git_refs)"
 }
 
+_git_send_email ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		__gitcomp "--bcc --cc --cc-cmd --chain-reply-to --compose
+			--dry-run --envelope-sender --from --identity
+			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
+			--no-suppress-from --no-thread --quiet
+			--signed-off-by-cc --smtp-pass --smtp-server
+			--smtp-server-port --smtp-ssl --smtp-user --subject
+			--suppress-cc --suppress-from --thread --to"
+		return
+		;;
+	esac
+	__git_complete_file
+}
+
 _git_config ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -1331,6 +1349,7 @@ _git ()
 	rebase)      _git_rebase ;;
 	remote)      _git_remote ;;
 	reset)       _git_reset ;;
+	send-email)  _git_send_email ;;
 	shortlog)    _git_shortlog ;;
 	show)        _git_show ;;
 	show-branch) _git_log ;;
@@ -1383,6 +1402,7 @@ complete -o default -o nospace -F _git_rebase git-rebase
 complete -o default -o nospace -F _git_config git-config
 complete -o default -o nospace -F _git_remote git-remote
 complete -o default -o nospace -F _git_reset git-reset
+complete -o default -o nospace -F _git_send_email git-send-email
 complete -o default -o nospace -F _git_shortlog git-shortlog
 complete -o default -o nospace -F _git_show git-show
 complete -o default -o nospace -F _git_stash git-stash
-- 
1.5.5.1.94.g80fd
Previous: Junio C Hamano
Message 12 of 12 in “git-format-patch: add a new format.cc configuration variable”
  1. git-format-patch: add a new format.cc configuration variableMiklos Vajna, Apr 26, 2008
  2. Johannes SchindelinApr 26, 2008
  3. Miklos VajnaApr 26, 2008
  4. Johannes SchindelinApr 27, 2008
  5. git-send-email: add a new sendemail.cc configuration variableMiklos Vajna, Apr 27, 2008
  6. Junio C HamanoApr 27, 2008
  7. Miklos VajnaApr 27, 2008
  8. Jeff KingApr 27, 2008
  9. Add tests for sendemail.cc configuration variableMiklos Vajna, Apr 29, 2008
  10. Jay SoffianApr 29, 2008
  11. Junio C HamanoApr 27, 2008
  12. bash: Add long option completion for 'git send-email'Teemu Likonen, Apr 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.