@matheusbsbs / matheus-bagliano / commits / 88293c675c
Fork 0

bash: Complete git-remote subcommands.

Completing the 3 core subcommands to git-remote, along with the names of remotes for 'show' and 'prune' (which take only existing remotes) is handy. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Feb 4, 2007 at 23:52 UTC 88293c675c0c15c8247de32e903f4302bac63027
1 file changed +28
contrib/completion/git-completion.bash
+28
@@ -852,6 +852,32 @@ _git_config ()
852 "
853 }
854
855 +_git_remote ()
856 +{
857 + local i c=1 command
858 + while [ $c -lt $COMP_CWORD ]; do
859 + i="${COMP_WORDS[c]}"
860 + case "$i" in
861 + add|show|prune) command="$i"; break ;;
862 + esac
863 + c=$((++c))
864 + done
865 +
866 + if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
867 + __gitcomp "add show prune"
868 + return
869 + fi
870 +
871 + case "$command" in
872 + show|prune)
873 + __gitcomp "$(__git_remotes)"
874 + ;;
875 + *)
876 + COMPREPLY=()
877 + ;;
878 + esac
879 +}
880 +
881 _git_reset ()
882 {
883 local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -934,6 +960,7 @@ _git ()
960 pull) _git_pull ;;
961 push) _git_push ;;
962 rebase) _git_rebase ;;
963 + remote) _git_remote ;;
964 reset) _git_reset ;;
965 show) _git_show ;;
966 show-branch) _git_log ;;
@@ -979,6 +1006,7 @@ complete -o default -o nospace -F _git_pull git-pull
1006 complete -o default -o nospace -F _git_push git-push
1007 complete -o default -o nospace -F _git_rebase git-rebase
1008 complete -o default -o nospace -F _git_config git-config
1009 +complete -o default -o nospace -F _git_remote git-remote
1010 complete -o default -o nospace -F _git_reset git-reset
1011 complete -o default -o nospace -F _git_show git-show
1012 complete -o default -o nospace -F _git_log git-show-branch