Thread (12 messages) flat view 12 messages, 4 authors, 2016-06-15
DORMANTno replies

[PATCH 4/4] bash: completion for gitk aliases

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:48:20
Subsystem: the rest · Maintainer: Linus Torvalds

gitk aliases either start with "!gitk", or look something like "!sh -c
FOO=bar gitk", IOW they contain the "gitk" word.  With this patch the
completion script will recognize these cases and will offer gitk's
options.

Just like the earlier change improving on aliased command recognition,
this change can also be fooled easily by some complex aliases, but
users of such aliases could remedy it with custom completion
functions.

Signed-off-by: SZEDER Gábor <redacted>
---
 contrib/completion/git-completion.bash |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8593fd7..3029f16 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -626,6 +626,10 @@ __git_aliased_command ()
 		config --get "alias.$1")
 	for word in $cmdline; do
 		case "$word" in
+		\!gitk|gitk)
+			echo "gitk"
+			return
+			;;
 		\!*)	: shell command alias ;;
 		-*)	: option ;;
 		*=*)	: setting env ;;
@@ -1087,6 +1091,11 @@ _git_gc ()
 	COMPREPLY=()
 }
 
+_git_gitk ()
+{
+	_gitk
+}
+
 _git_grep ()
 {
 	__git_has_doubledash && return
-- 
1.7.0.119.g9b76
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help