diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-24 10:33:08 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-24 10:33:08 +0200 |
| commit | 40cd61ce7e0c4a8d35d0e0a505994f9f9b5e4d67 (patch) | |
| tree | 245aba80c137bea9e22662ea4a6363741d4f97fe /completions/gitctl.bash | |
| parent | 9c301a8eac944083556b3dce297764b4fca7d49a (diff) | |
| download | gitctl-40cd61ce7e0c4a8d35d0e0a505994f9f9b5e4d67.tar.gz gitctl-40cd61ce7e0c4a8d35d0e0a505994f9f9b5e4d67.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'completions/gitctl.bash')
| -rw-r--r-- | completions/gitctl.bash | 14 |
1 files changed, 14 insertions, 0 deletions
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")) |
