Skip to content

Commit dfbe5ee

Browse files
jacob-kellerpeff
authored andcommitted
completion: add support for completing email aliases
Using the new --dump-aliases option from git-send-email, add completion for --to, --cc, --bcc, and --from with the available configured aliases. Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 17b7a83 commit dfbe5ee

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# *) local and remote tag names
1111
# *) .git/remotes file names
1212
# *) git 'subcommands'
13+
# *) git email aliases for git-send-email
1314
# *) tree paths within 'ref:path/to/file' expressions
1415
# *) file paths within current working directory and index
1516
# *) common --long-options
@@ -1711,6 +1712,15 @@ __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
17111712

17121713
_git_send_email ()
17131714
{
1715+
case "$prev" in
1716+
--to|--cc|--bcc|--from)
1717+
__gitcomp "
1718+
$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
1719+
" "" ""
1720+
return
1721+
;;
1722+
esac
1723+
17141724
case "$cur" in
17151725
--confirm=*)
17161726
__gitcomp "
@@ -1735,6 +1745,12 @@ _git_send_email ()
17351745
" "" "${cur##--thread=}"
17361746
return
17371747
;;
1748+
--to=*|--cc=*|--bcc=*|--from=*)
1749+
__gitcomp "
1750+
$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
1751+
" "" "${cur#--*=}"
1752+
return
1753+
;;
17381754
--*)
17391755
__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
17401756
--compose --confirm= --dry-run --envelope-sender

0 commit comments

Comments
 (0)