diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-30 17:44:35 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-30 17:44:35 +0100 |
| commit | 98f7dde49951062c16f260467f4a421c2b2ca0a3 (patch) | |
| tree | 6f0e9899269d9a874f6c907ae87c54fea5ebdc36 /completions | |
| parent | 4c1dc7e48169e2afed3bd90a7044ffd59cfd1029 (diff) | |
| download | gitctl-master.tar.gz gitctl-master.zip | |
There was no way to change a repo's cgit section short of deleting and
recreating it or hand-editing cgitrc, which gitctl exists to prevent.
The helper gains move-repo, built from the existing pair: the block's
repo.* lines (desc included) are lifted out, remove_repo_block drops
them, insert_repo_block files them at the end of the target section's
span, so spacing follows the same rules as add and delete. It refuses a
repo not in cgit and a missing section, and is a no-op when the repo is
already there. The client's repo move ensures the section exists first.
Self-tests cover the block move, the file round trip and both refusals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'completions')
| -rw-r--r-- | completions/gitctl.bash | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/completions/gitctl.bash b/completions/gitctl.bash index 497d0a8..520d842 100644 --- a/completions/gitctl.bash +++ b/completions/gitctl.bash @@ -29,13 +29,13 @@ _gitctl() { return fi - # complete repo names for the name argument of desc/delete/add-remote (one + # complete repo names for the name argument of desc/move/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 + && ( $action == desc || $action == move || $action == delete || $action == add-remote ) ]]; then local repos repos=$(gitctl repo list 2>/dev/null | awk 'NR>1 {print $1}') local IFS=$'\n' @@ -50,7 +50,7 @@ _gitctl() { 2) case $group in sections) COMPREPLY=($(compgen -W "list add" -- "$cur")) ;; - repo) COMPREPLY=($(compgen -W "create list desc add-remote delete" -- "$cur")) ;; + repo) COMPREPLY=($(compgen -W "create list desc move add-remote delete" -- "$cur")) ;; esac return ;; esac @@ -59,6 +59,7 @@ _gitctl() { if [[ $cur == -* ]]; then case "$group $action" in "repo create") COMPREPLY=($(compgen -W "--section --private --desc --owner" -- "$cur")) ;; + "repo move") COMPREPLY=($(compgen -W "--section" -- "$cur")) ;; "repo add-remote") COMPREPLY=($(compgen -W "--remote-name" -- "$cur")) ;; esac return |
