tidy completions
authorShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 03:03:29 +0000 (22:03 -0500)
committerShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 03:08:28 +0000 (22:08 -0500)
completions/bash/git-remote-gcrypt
completions/fish/git-remote-gcrypt.fish
completions/zsh/_git-remote-gcrypt
utils/gen_docs.sh

index 6415eaf5e077d726ac004a08c58245db8a34f9c2..5428873781e365709c65bbec491c754c2e8719ec 100644 (file)
@@ -22,7 +22,7 @@ _git_remote_gcrypt() {
        case "${COMP_WORDS[1]}" in
        clean)
                local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :)
-               COMPREPLY=($(compgen -W "--force Actually --init Allow --hard Override $remotes" -- "$cur"))
+               COMPREPLY=($(compgen -W "--force --init --hard $remotes" -- "$cur"))
                return 0
                ;;
        check | stat)
index 52496c172a597777785d1a2ed4a6a990b5c925f6..bdb8d42f4aa392ba3d5d7be567a680245134e591 100644 (file)
@@ -13,7 +13,6 @@ complete -c git-remote-gcrypt -n "__fish_seen_subcommand_from check" -a "(git re
 complete -c git-remote-gcrypt -n "__fish_seen_subcommand_from stat" -a "(git remote 2>/dev/null)" -d 'Git Remote'
 
 # Clean flags
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -force -l Actually -d 'Flag';
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -init -l Allow -d 'Flag';
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s -hard -l Override -d 'Flag';
-
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l force -d 'Flag'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l init -d 'Flag'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l hard -d 'Flag'
index 415c3d1b5eb6c2fa62f41ea19aa4a34e8fed677c..0b86da0044c54f27b32ecc09f93487cdaaa465ea 100644 (file)
@@ -14,7 +14,7 @@ _git_remote_gcrypt() {
 
        case $line[1] in
        clean)
-               _arguments '(--force Actually --init Allow --hard Override)'{--force,Actually,--init,Allow,--hard,Override}'[flag]' \
+               _arguments '(--force --init --hard)'{--force,--init,--hard}'[flag]' \
                        '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"'
                ;;
        check | stat)
index d14b84d3b8c55e41315040e738a6911f922460fe..217beda8ee1d93788eef88508aaf1ddd96f428ad 100755 (executable)
@@ -36,9 +36,9 @@ COMMANDS_HELP=$(echo "$RAW_HELP" | sed -n '/^Options:/,$p' | sed 's/^/    /' | s
 COMMANDS_LIST=$(echo "$RAW_HELP" | awk '/^  [a-z]+ / {print $1}' | grep -vE "^(help|version|capabilities|list|push|fetch)$" | sort | tr '\n' ' ' | sed 's/ $//')
 
 # Extract clean flags
-# Text: "    clean -f, --force    Actually delete files..."
-# We want: "-f --force -i --init" for Bash
-CLEAN_FLAGS_RAW=$(echo "$RAW_HELP" | grep "^    clean -" | awk '{print $2, $3}' | sed 's/,//g')
+# Text: "    clean --force        Actually delete files..."
+# We want: "--force --init --hard"
+CLEAN_FLAGS_RAW=$(echo "$RAW_HELP" | grep "^    clean -" | awk '{print $2}')
 CLEAN_FLAGS_BASH=$(echo "$CLEAN_FLAGS_RAW" | tr '\n' ' ' | sed 's/ $//')
 
 # For Zsh: we want simple list for now as per plan, user asked for dynamic but safe.
@@ -51,25 +51,28 @@ CLEAN_FLAGS_ZSH=""
 COMMA_FLAGS=$(echo "$CLEAN_FLAGS_BASH" | tr ' ' ',')
 if [ -n "$CLEAN_FLAGS_BASH" ]; then
        # zsh _arguments requires format: '(exclusion)'{-f,--long}'[desc]' as ONE string (no spaces)
+       # Since we only have one flag per line now (long only), exclusion is just itself or list of all?
+       # Mutually exclusive? Maybe. For now, simple list.
+       # Actually, with single flags, no need for the {...} brace expansion for aliases.
+       # Just list them.
        CLEAN_FLAGS_ZSH="'(${CLEAN_FLAGS_BASH})'{${COMMA_FLAGS}}'[flag]'"
 else
        CLEAN_FLAGS_ZSH=""
 fi
 
-# For Fish
-# We need to turn "-f, --force" into:
-# complete ... -s f -l force ...
 CLEAN_FLAGS_FISH=""
 # Use a loop over the raw lines
 IFS="
 "
+newline="
+"
+sep=""
 for line in $CLEAN_FLAGS_RAW; do
-       # line is like "-f --force"
-       short=$(echo "$line" | awk '{print $1}' | sed 's/-//')
-       long=$(echo "$line" | awk '{print $2}' | sed 's/--//')
+       # line is just "--force" now
+       long="${line#--}"
        # Escape quotes if needed (none usually)
-       CLEAN_FLAGS_FISH="${CLEAN_FLAGS_FISH}complete -c git-remote-gcrypt -f -n \"__fish_seen_subcommand_from clean\" -s $short -l $long -d 'Flag';
-"
+       CLEAN_FLAGS_FISH="${CLEAN_FLAGS_FISH}${sep}complete -c git-remote-gcrypt -f -n \"__fish_seen_subcommand_from clean\" -l $long -d 'Flag'"
+       sep="$newline"
 done
 unset IFS