Teach bash completion about 'git remote update'
Recently the git-remote command grew an update subcommand, which can be used to execute git-fetch across multiple repositories in a single step. These can be configured with the 'remotes.*' configuration options, so we can offer completion for any name that matches and appears to be useful to git-remote update. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
May 24, 2007 at 01:46 UTC
fb72759b7de504f077250fd5bd557e3b9e2a5682
1 file changed
+14
-2
contrib/completion/git-completion.bash
+14
-2
@@ -877,13 +877,13 @@ _git_remote ()
877
while [ $c -lt $COMP_CWORD ]; do
878
i="${COMP_WORDS[c]}"
879
case "$i" in
880
- add|show|prune) command="$i"; break ;;
880
+ add|show|prune|update) command="$i"; break ;;
881
esac
882
c=$((++c))
883
done
884
885
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
886
- __gitcomp "add show prune"
886
+ __gitcomp "add show prune update"
887
return
888
fi
889
@@ -891,6 +891,18 @@ _git_remote ()
891
show|prune)
892
__gitcomp "$(__git_remotes)"
893
;;
894
+ update)
895
+ local i c='' IFS=$'\n'
896
+ for i in $(git --git-dir="$(__gitdir)" config --list); do
897
+ case "$i" in
898
+ remotes.*)
899
+ i="${i#remotes.}"
900
+ c="$c ${i/=*/}"
901
+ ;;
902
+ esac
903
+ done
904
+ __gitcomp "$c"
905
+ ;;
906
*)
907
COMPREPLY=()
908
;;