From 96451a4d79ef4924d763f9523b520110b9b08834 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Wed, 14 Jan 2026 12:19:57 -0500 Subject: [PATCH] update completions --- completions/bash/git-remote-gcrypt | 4 ++-- completions/templates/bash.in | 4 ++-- completions/templates/zsh.in | 1 - completions/zsh/_git-remote-gcrypt | 1 - utils/gen_docs.sh | 9 ++++++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/completions/bash/git-remote-gcrypt b/completions/bash/git-remote-gcrypt index a4d279e..baf0715 100644 --- a/completions/bash/git-remote-gcrypt +++ b/completions/bash/git-remote-gcrypt @@ -21,12 +21,12 @@ _git_remote_gcrypt() { # 2. Handle subcommands case "${COMP_WORDS[1]}" in clean) - local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || : + local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :) COMPREPLY=($(compgen -W " $remotes" -- "$cur")) return 0 ;; check) - local remotes=$(git remote 2>/dev/null || : + local remotes=$(git remote 2>/dev/null || :) COMPREPLY=($(compgen -W "$remotes" -- "$cur")) return 0 ;; diff --git a/completions/templates/bash.in b/completions/templates/bash.in index d132927..32956ad 100644 --- a/completions/templates/bash.in +++ b/completions/templates/bash.in @@ -21,12 +21,12 @@ _git_remote_gcrypt() { # 2. Handle subcommands case "${COMP_WORDS[1]}" in clean) - local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || : + local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :) COMPREPLY=($(compgen -W "{clean_flags_bash} $remotes" -- "$cur")) return 0 ;; check) - local remotes=$(git remote 2>/dev/null || : + local remotes=$(git remote 2>/dev/null || :) COMPREPLY=($(compgen -W "$remotes" -- "$cur")) return 0 ;; diff --git a/completions/templates/zsh.in b/completions/templates/zsh.in index b357d1f..329bdb1 100644 --- a/completions/templates/zsh.in +++ b/completions/templates/zsh.in @@ -15,7 +15,6 @@ _git_remote_gcrypt() { case $line[1] in clean) _arguments \ - {clean_flags_zsh} \ '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"' ;; check) diff --git a/completions/zsh/_git-remote-gcrypt b/completions/zsh/_git-remote-gcrypt index d937362..ceb5ae5 100644 --- a/completions/zsh/_git-remote-gcrypt +++ b/completions/zsh/_git-remote-gcrypt @@ -15,7 +15,6 @@ _git_remote_gcrypt() { case $line[1] in clean) _arguments \ - '()' {} '[flag]' \ '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"' ;; check) diff --git a/utils/gen_docs.sh b/utils/gen_docs.sh index 878ccc2..eab2ba7 100755 --- a/utils/gen_docs.sh +++ b/utils/gen_docs.sh @@ -47,10 +47,13 @@ CLEAN_FLAGS_BASH=$(echo "$CLEAN_FLAGS_RAW" | tr '\n' ' ' | sed 's/ $//') CLEAN_FLAGS_ZSH="" # We'll just provide the flags as a list for _arguments # ZSH format roughly: '(-f --force)'{-f,--force}'[desc]' -# Let's simplify and just pass the flags for now to match the user's "native completion" request without over-engineering the parsing in shell. -# We will just list them. +# Only generate if there are actual flags COMMA_FLAGS=$(echo "$CLEAN_FLAGS_BASH" | tr ' ' ',') -CLEAN_FLAGS_ZSH="'(${CLEAN_FLAGS_BASH})' {${COMMA_FLAGS}} '[flag]'" +if [ -n "$CLEAN_FLAGS_BASH" ]; then + CLEAN_FLAGS_ZSH="'(${CLEAN_FLAGS_BASH})' {${COMMA_FLAGS}} '[flag]'" +else + CLEAN_FLAGS_ZSH="" +fi # For Fish # We need to turn "-f, --force" into: -- 2.52.0