aboutsummaryrefslogtreecommitdiffstats
path: root/completions/gitctl.bash
diff options
context:
space:
mode:
Diffstat (limited to 'completions/gitctl.bash')
-rw-r--r--completions/gitctl.bash9
1 files changed, 7 insertions, 2 deletions
diff --git a/completions/gitctl.bash b/completions/gitctl.bash
index 6fead65..3d072fe 100644
--- a/completions/gitctl.bash
+++ b/completions/gitctl.bash
@@ -12,7 +12,12 @@ _gitctl() {
cword=$COMP_CWORD
}
- local group=${words[1]} action=${words[2]}
+ # global -y/--yes may sit before the subcommand; skip it so group/action and
+ # the cword positions below line up whether or not it is present.
+ local off=0
+ [[ ${words[1]} == "-y" || ${words[1]} == "--yes" ]] && off=1
+ local group=${words[1+off]} action=${words[2+off]}
+ local cword=$((cword - off))
# complete section names from the live server (one ssh call). Only when the
# previous word is --section, so we do not pay it on every Tab.
@@ -26,7 +31,7 @@ _gitctl() {
case $cword in
1)
- COMPREPLY=($(compgen -W "sections sync repo" -- "$cur"))
+ COMPREPLY=($(compgen -W "-y --yes sections sync repo" -- "$cur"))
return ;;
2)
case $group in