From 9b2328bcb46b1b5fd074fdbc2c4bea8855220276 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 23 Jun 2026 11:18:05 +0200 Subject: Initial commit: gitctl Thin CLI plus a server helper (run as the git user) to manage repos on a personal gitolite3 + cgit server over a command=-restricted SSH key. Includes the client, the helper, bash completion, a Claude Code skill, and docs. Co-Authored-By: Claude Opus 4.8 --- completions/gitctl.bash | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 completions/gitctl.bash (limited to 'completions') diff --git a/completions/gitctl.bash b/completions/gitctl.bash new file mode 100644 index 0000000..0b680dd --- /dev/null +++ b/completions/gitctl.bash @@ -0,0 +1,48 @@ +# bash completion for gitctl +# install: cp completions/gitctl.bash /etc/bash_completion.d/gitctl +# or: source completions/gitctl.bash (from ~/.bashrc) + +_gitctl() { + local cur prev words cword + _init_completion 2>/dev/null || { + # minimal fallback if bash-completion's _init_completion is absent + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + words=("${COMP_WORDS[@]}") + cword=$COMP_CWORD + } + + local group=${words[1]} action=${words[2]} + + # complete section names from the live server (one ssh call). Only when the + # previous word is --section, so we do not pay it on every Tab. + if [[ $prev == "--section" ]]; then + local secs + secs=$(gitctl sections list 2>/dev/null) + local IFS=$'\n' + COMPREPLY=($(compgen -W "$secs" -- "$cur")) + return + fi + + case $cword in + 1) + COMPREPLY=($(compgen -W "sections sync repo" -- "$cur")) + return ;; + 2) + case $group in + sections) COMPREPLY=($(compgen -W "list add" -- "$cur")) ;; + repo) COMPREPLY=($(compgen -W "create desc add-remote" -- "$cur")) ;; + esac + return ;; + esac + + # flags, by subcommand + if [[ $cur == -* ]]; then + case "$group $action" in + "repo create") COMPREPLY=($(compgen -W "--section --desc --owner" -- "$cur")) ;; + "repo add-remote") COMPREPLY=($(compgen -W "--remote-name" -- "$cur")) ;; + esac + return + fi +} +complete -F _gitctl gitctl -- cgit v1.2.3