aboutsummaryrefslogtreecommitdiffstats
path: root/completions/gitctl.bash
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-24 09:57:33 +0200
committerDanilo M. <danix@danix.xyz>2026-06-24 09:57:33 +0200
commit345968271dec38b33a32649d8cfb767c2806330d (patch)
treedf90e30c02189a38628bc10829fecfebec0b53d4 /completions/gitctl.bash
parenteeaba25642392532901cd4c95c23054e9a7ba2b3 (diff)
downloadgitctl-345968271dec38b33a32649d8cfb767c2806330d.tar.gz
gitctl-345968271dec38b33a32649d8cfb767c2806330d.zip
feat: global -y/--yes flag to skip additive confirmations
repo create's y/N push confirmation can now be skipped with -y. The flag is global (top-level parser), so it goes before the subcommand: gitctl -y repo create ... . The diff is still printed and an auto-confirmed note shown. -y does NOT bypass SSH key auth (the phase-1 push still needs the password / smartcard touch), so creation is never fully unattended. Hard wall: -y is never honored by a future destructive delete; the flag help, a client comment, and TODO item 1 all record this. Bash completion offers -y at the top level and transparently skips a leading -y when resolving the subcommand. Self-test pins the parse round-trip. Client-only change; the server helper is unchanged, no redeploy needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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