aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorCornelius Weig <cornelius.weig@tngtech.com>2017-02-03 12:01:58 +0100
committerJunio C Hamano <gitster@pobox.com>2017-02-03 22:25:46 -0800
commitcac84960ea5a3f97c52dae7bf05591237bc0303d (patch)
tree29f4ddc0274319db17c6591b87c4d965257b37a3 /contrib
parent188fba1172964da1d0169535e859381c3f2b1191 (diff)
downloadgit-cac84960ea5a3f97c52dae7bf05591237bc0303d.tar.gz
git-cac84960ea5a3f97c52dae7bf05591237bc0303d.tar.xz
completion: teach remote subcommands to complete options
Git-remote needs to complete remote names, its subcommands, and options thereof. In addition to the existing subcommand and remote name completion, do also complete the options - add: --track --master --fetch --tags --no-tags --mirror= - set-url: --push --add --delete - get-url: --push --all - prune: --dry-run Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com> Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash45
1 files changed, 38 insertions, 7 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8c6736e4c..a3b25d04e 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2384,24 +2384,55 @@ _git_config ()
_git_remote ()
{
- local subcommands="add rename remove set-head set-branches set-url show prune update"
+ local subcommands="
+ add rename remove set-head set-branches
+ get-url set-url show prune update
+ "
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- __gitcomp "$subcommands"
+ case "$cur" in
+ --*)
+ __gitcomp "--verbose"
+ ;;
+ *)
+ __gitcomp "$subcommands"
+ ;;
+ esac
return
fi
- case "$subcommand" in
- rename|remove|set-url|show|prune)
- __gitcomp_nl "$(__git_remotes)"
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp "--track --master --fetch --tags --no-tags --mirror="
+ ;;
+ add,*)
+ ;;
+ set-head,--*)
+ __gitcomp "--auto --delete"
;;
- set-head|set-branches)
+ set-branches,--*)
+ __gitcomp "--add"
+ ;;
+ set-head,*|set-branches,*)
__git_complete_remote_or_refspec
;;
- update)
+ update,--*)
+ __gitcomp "--prune"
+ ;;
+ update,*)
__gitcomp "$(__git_get_config_variables "remotes")"
;;
+ set-url,--*)
+ __gitcomp "--push --add --delete"
+ ;;
+ get-url,--*)
+ __gitcomp "--push --all"
+ ;;
+ prune,--*)
+ __gitcomp "--dry-run"
+ ;;
*)
+ __gitcomp_nl "$(__git_remotes)"
;;
esac
}