diff options
Diffstat (limited to 'completions')
| -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")) |
