git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash completion: add git-difftool
@ 2009-04-02 11:30 David Aguilar
  2009-04-05 19:43 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: David Aguilar @ 2009-04-02 11:30 UTC (permalink / raw)
  To: gitster, spearce; +Cc: git, David Aguilar

This adds completion for difftool's --tool flag.
The known diff tool names were also consolidated into
a single variable.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/completion/git-completion.bash |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4fcd77a..33a8ec7 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -909,6 +909,26 @@ _git_diff ()
 	__git_complete_file
 }
 
+__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
+			tkdiff vimdiff gvimdiff xxdiff
+"
+
+_git_difftool ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--tool=*)
+		__gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"
+		return
+		;;
+	--*)
+		__gitcomp "--tool="
+		return
+		;;
+	esac
+	COMPREPLY=()
+}
+
 __git_fetch_options="
 	--quiet --verbose --append --upload-pack --force --keep --depth=
 	--tags --no-tags
@@ -1171,11 +1191,7 @@ _git_mergetool ()
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 	case "$cur" in
 	--tool=*)
-		__gitcomp "
-			kdiff3 tkdiff meld xxdiff emerge
-			vimdiff gvimdiff ecmerge diffuse
-			opendiff
-			" "" "${cur##--tool=}"
+		__gitcomp "$__git_mergetools_common" "" "${cur##--tool=}"
 		return
 		;;
 	--*)
@@ -1900,6 +1916,7 @@ _git ()
 	config)      _git_config ;;
 	describe)    _git_describe ;;
 	diff)        _git_diff ;;
+	difftool)    _git_difftool;;
 	fetch)       _git_fetch ;;
 	format-patch) _git_format_patch ;;
 	fsck)        _git_fsck ;;
-- 
1.6.2.1.469.gdffc1

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

* Re: [PATCH] bash completion: add git-difftool
  2009-04-02 11:30 [PATCH] bash completion: add git-difftool David Aguilar
@ 2009-04-05 19:43 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-04-05 19:43 UTC (permalink / raw)
  To: David Aguilar; +Cc: gitster, git

David Aguilar <davvid@gmail.com> wrote:
> This adds completion for difftool's --tool flag.
> The known diff tool names were also consolidated into
> a single variable.

Looks good to me.  I see Junio has it slated in pu currently.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
 
-- 
Shawn.

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

end of thread, other threads:[~2009-04-05 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 11:30 [PATCH] bash completion: add git-difftool David Aguilar
2009-04-05 19:43 ` Shawn O. Pearce

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