fix: termux action and format/generate targets
authorShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 07:38:40 +0000 (02:38 -0500)
committerShane Jaroch <chown_tee@proton.me>
Sat, 17 Jan 2026 07:38:40 +0000 (02:38 -0500)
.github/workflows/termux-android.yml
Makefile
completions/fish/git-remote-gcrypt.fish
completions/gen_docs.sh
completions/zsh/_git-remote-gcrypt

index d0bde006bd9fff47c80993fcd6a41fd23567fb5c..dbd59aa3f1372a00be470498b9a8514a4dfb2db5 100644 (file)
@@ -13,6 +13,9 @@ jobs:
     steps:
       - uses: actions/checkout@v4
 
+      - name: Fix permissions for Docker
+        run: chmod -R 777 .
+
       - name: Run tests in Termux
         run: |
           docker run --rm \
index 0316c5de1c0ae465031fe2f17fa705010d2630b5..2b306c6bad003939a9a174885e13908c5b5f188d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,7 @@ check/deps:   ##H Verify kcov & shellcheck
 
 LINT_LOCS_PY ?= $(shell git ls-files '*.py')
 LINT_LOCS_SH ?= $(shell git ls-files '*.sh' ':!tests/system-test.sh')
-FORMAT_LOCS_SHELL ?= completions/*.sh completions/**/*
+FORMAT_LOCS_SHELL ?= completions/*.sh completions/bash/* completions/zsh/* completions/fish/* completions/templates/bash.in completions/templates/zsh.in completions/templates/fish.in
 
 .PHONY: format
 format:        ##H Format scripts
index bdb8d42f4aa392ba3d5d7be567a680245134e591..9a6a0bd5da69fe5fab22d7314b38ddaf70f5e491 100644 (file)
@@ -13,6 +13,8 @@ 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" -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'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l force -d '       Actually delete files (default is scan only)
+        Allow cleaning uninitialized repos (requires --force)
+        Override safety checks (requires --force)'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l init -d '        Allow cleaning uninitialized repos (requires --force)'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l hard -d '        Override safety checks (requires --force)'
index 8cd02dfa8c111caed51f1ae6a02b5907a08e7ed7..c27658123e2c5fa672fb13bca89a0cf6dd2372fb 100755 (executable)
@@ -85,12 +85,11 @@ CLEAN_FLAGS_ZSH=$(echo "$CLEAN_FLAGS_RAW" | while read -r line; do
        desc="[Flag]"
 
        # Use printf to avoid newline issues in variable
-       # Note: Zsh format is 'exclusion:long:desc' or 'exclusion'flag'desc'
-       # '(-f --force)'{-f,--force}'[Actually delete files]'
+       # Zsh format: '(-f --force)'{-f,--force}'[Actually delete files]'
        if [ -n "$excl" ]; then
-               printf " '%s'%s'%s'" "$excl" "$fspec" "$desc"
+               printf "'%s'%s'%s'" "$excl" "$fspec" "$desc"
        else
-               printf " %s'%s'" "$fspec" "$desc"
+               printf "%s'%s'" "$fspec" "$desc"
        fi
 done | tr '\n' ' ')
 
@@ -105,34 +104,30 @@ CLEAN_FLAGS_FISH=$(echo "$CLEAN_FLAGS_RAW" | while read -r line; do
 
        # Split by space
        # Case 1: "-f --force" -> field1=-f, field2=--force
-       # Case 2: "--hard" -> field1=--hard
        f1=$(echo "$line" | awk '{print $1}')
        f2=$(echo "$line" | awk '{print $2}')
 
-       if echo "$f1" | grep -q "^--"; then
-               # Starts with --, so it's a long flag.
-               long=${f1#--}
-               # f2 is likely empty or next flag (but we assume cleaned format)
-               if [ -n "$f2" ]; then
-                       # Should be descriptor or unexpected? Our parser above extracts only flags.
-                       # But our parser above might extract "-f --force" as "$2 $3".
-                       # If $2 is -f and $3 is --force.
-                       # Just in case, let's treat f2 as potentially another flag if we didn't handle it?
-                       # Actually, the parser at top produces "flag1 flag2".
-                       :
-               fi
+       # Description is looked up separately via grep because it contains spaces
+       # escape single quotes for Fish string
+       desc=$(echo "$RAW_HELP" | grep -F -- "$line" | sed 's/^[[:space:]]*//' | cut -d ' ' -f 3- | sed "s/'/\\\\'/g")
+
+       if [[ "$f1" == -* ]] && [[ "$f2" == --* ]]; then
+               short="${f1#-}"
+               long="${f2#--}"
+       elif [[ "$f1" == --* ]]; then
+               long="${f1#--}"
        else
                # Starts with - (short)
-               short=${f1#-}
+               short="${f1#-}"
                if [ -n "$f2" ] && echo "$f2" | grep -q "^--"; then
-                       long=${f2#--}
+                       long="${f2#--}"
                fi
        fi
 
        cmd='complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean"'
        [ -n "$short" ] && cmd="$cmd -s $short"
        [ -n "$long" ] && cmd="$cmd -l $long"
-       cmd="$cmd -d 'Flag';"
+       cmd="$cmd -d '$desc'"
 
        printf "%s\n" "$cmd"
 done)
index 7de0fd92736a5647659e0611adc86ebc84fd58ac..acf8053e9c46140e8d57f094dbec1438053224c4 100644 (file)
@@ -14,7 +14,7 @@ _git_remote_gcrypt() {
 
        case $line[1] in
                clean)
-                       _arguments --force'[Flag]' --init'[Flag]' --hard'[Flag]' \
+                       _arguments --force'[Flag]'--init'[Flag]'--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)