From 40cd61ce7e0c4a8d35d0e0a505994f9f9b5e4d67 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 24 Jun 2026 10:33:08 +0200 Subject: feat: repo-name completion + label helper passthrough output - Bash completion now completes repo NAMES for desc/delete/add-remote at the name position, sourced from `gitctl repo list` (first field, header row dropped). One ssh call, only at that position, so a stray Tab never hits the network; the leading -y is handled. - call_helper prefixes every passthrough line from the helper (and the sync script it runs) with "server: " via _server_prefixed, so output like "No changes." reads as remote output instead of interleaved local noise. quiet=True callers (repo list) still get raw stdout to parse. Client-only, no helper redeploy needed. Self-test pins _server_prefixed. Co-Authored-By: Claude Opus 4.8 --- completions/gitctl.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'completions') diff --git a/completions/gitctl.bash b/completions/gitctl.bash index 929346d..321a917 100644 --- a/completions/gitctl.bash +++ b/completions/gitctl.bash @@ -29,6 +29,20 @@ _gitctl() { return fi + # complete repo names for the name argument of desc/delete/add-remote (one + # ssh call). Only at the name position and not while typing a flag, so a + # stray Tab elsewhere never hits the network. `repo list` prints an aligned + # table (no color when not a TTY, as here); the name is the first field, and + # we drop the NAME header row. + if [[ $cword -eq 3 && $group == repo && $cur != -* \ + && ( $action == desc || $action == delete || $action == add-remote ) ]]; then + local repos + repos=$(gitctl repo list 2>/dev/null | awk 'NR>1 {print $1}') + local IFS=$'\n' + COMPREPLY=($(compgen -W "$repos" -- "$cur")) + return + fi + case $cword in 1) COMPREPLY=($(compgen -W "-y --yes sections sync repo" -- "$cur")) -- cgit v1.2.3