From 98f7dde49951062c16f260467f4a421c2b2ca0a3 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 30 Oct 2026 17:44:35 +0100 Subject: Add repo move: refile a public repo under another section 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 --- completions/gitctl.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'completions') 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 -- cgit v1.2.3