@matheusbsbs / matheus-bagliano / commits / e2dc2de917
Fork 0

bash completion: add git-difftool

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>

David Aguilar committed Apr 6, 2009 at 01:31 UTC e2dc2de917778a0601564e238c3cd61614f55e5f
1 file changed +22 -5
contrib/completion/git-completion.bash
+22 -5
@@ -910,6 +910,26 @@ _git_diff ()
910 __git_complete_file
911 }
912
913 +__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
914 + tkdiff vimdiff gvimdiff xxdiff
915 +"
916 +
917 +_git_difftool ()
918 +{
919 + local cur="${COMP_WORDS[COMP_CWORD]}"
920 + case "$cur" in
921 + --tool=*)
922 + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"
923 + return
924 + ;;
925 + --*)
926 + __gitcomp "--tool="
927 + return
928 + ;;
929 + esac
930 + COMPREPLY=()
931 +}
932 +
933 __git_fetch_options="
934 --quiet --verbose --append --upload-pack --force --keep --depth=
935 --tags --no-tags
@@ -1172,11 +1192,7 @@ _git_mergetool ()
1192 local cur="${COMP_WORDS[COMP_CWORD]}"
1193 case "$cur" in
1194 --tool=*)
1175 - __gitcomp "
1176 - kdiff3 tkdiff meld xxdiff emerge
1177 - vimdiff gvimdiff ecmerge diffuse
1178 - opendiff
1179 - " "" "${cur##--tool=}"
1195 + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
1196 return
1197 ;;
1198 --*)
@@ -1901,6 +1917,7 @@ _git ()
1917 config) _git_config ;;
1918 describe) _git_describe ;;
1919 diff) _git_diff ;;
1920 + difftool) _git_difftool ;;
1921 fetch) _git_fetch ;;
1922 format-patch) _git_format_patch ;;
1923 fsck) _git_fsck ;;