Skip to content

Commit

Permalink
bash completion: add git-difftool
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
David Aguilar authored and Junio C Hamano committed Apr 8, 2009
1 parent a904392 commit e2dc2de
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,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
Expand Down Expand Up @@ -1172,11 +1192,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 tortoisemerge" "" "${cur##--tool=}"
return
;;
--*)
Expand Down Expand Up @@ -1901,6 +1917,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 ;;
Expand Down

0 comments on commit e2dc2de

Please sign in to comment.