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>
This commit is contained in:
parent
c70680ce7c
commit
fb72759b7d
@ -877,13 +877,13 @@ _git_remote ()
|
|||||||
while [ $c -lt $COMP_CWORD ]; do
|
while [ $c -lt $COMP_CWORD ]; do
|
||||||
i="${COMP_WORDS[c]}"
|
i="${COMP_WORDS[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
add|show|prune) command="$i"; break ;;
|
add|show|prune|update) command="$i"; break ;;
|
||||||
esac
|
esac
|
||||||
c=$((++c))
|
c=$((++c))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
|
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
|
||||||
__gitcomp "add show prune"
|
__gitcomp "add show prune update"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -891,6 +891,18 @@ _git_remote ()
|
|||||||
show|prune)
|
show|prune)
|
||||||
__gitcomp "$(__git_remotes)"
|
__gitcomp "$(__git_remotes)"
|
||||||
;;
|
;;
|
||||||
|
update)
|
||||||
|
local i c='' IFS=$'\n'
|
||||||
|
for i in $(git --git-dir="$(__gitdir)" config --list); do
|
||||||
|
case "$i" in
|
||||||
|
remotes.*)
|
||||||
|
i="${i#remotes.}"
|
||||||
|
c="$c ${i/=*/}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
__gitcomp "$c"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user