From: Shane Jaroch Date: Sat, 17 Jan 2026 07:38:40 +0000 (-0500) Subject: fix: termux action and format/generate targets X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=9d40d9df9072dbbc60fb475d26ae19512c5d20c9;p=gamesguru%2Fgit-remote-gcrypt.git fix: termux action and format/generate targets --- diff --git a/.github/workflows/termux-android.yml b/.github/workflows/termux-android.yml index d0bde00..dbd59aa 100644 --- a/.github/workflows/termux-android.yml +++ b/.github/workflows/termux-android.yml @@ -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 \ diff --git a/Makefile b/Makefile index 0316c5d..2b306c6 100644 --- 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 diff --git a/completions/fish/git-remote-gcrypt.fish b/completions/fish/git-remote-gcrypt.fish index bdb8d42..9a6a0bd 100644 --- a/completions/fish/git-remote-gcrypt.fish +++ b/completions/fish/git-remote-gcrypt.fish @@ -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)' diff --git a/completions/gen_docs.sh b/completions/gen_docs.sh index 8cd02df..c276581 100755 --- a/completions/gen_docs.sh +++ b/completions/gen_docs.sh @@ -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) diff --git a/completions/zsh/_git-remote-gcrypt b/completions/zsh/_git-remote-gcrypt index 7de0fd9..acf8053 100644 --- a/completions/zsh/_git-remote-gcrypt +++ b/completions/zsh/_git-remote-gcrypt @@ -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)