1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

users/10564: _gpg key ring fix

This commit is contained in:
Peter Stephenson 2006-08-01 11:31:22 +00:00
parent e7944e7606
commit f34e095f4b
2 changed files with 25 additions and 3 deletions

@ -1,3 +1,8 @@
2006-08-01 Peter Stephenson <pws@csr.com>
* users/10564: Completion/Unix/Command/_gpg: use appropriate
key ring arguments to search key rings.
2006-07-30 Barton E. Schaefer <schaefer@zsh.org>
* unposted (see users/10559): Functions/Zle/keymap+widget: a

@ -139,18 +139,35 @@ if [[ $state = args ]]; then
fi
fi
# We need to keep some arguments to get a consistent list of keys
# etc.
local -a needed
integer krind=${words[(I)--keyring(|=*)]}
needed=(${words[(r)--no-default-keyring]})
if (( krind )); then
# We have a --keyring option. We can't be completing its
# argument because that was handled above, so it must be complete.
if [[ $words[krind] = --keyring ]]; then
if [[ -n $words[krind+1] ]]; then
needed+=(--keyring=$words[krind+1])
fi
else
needed+=($words[krind])
fi
fi
case "$state" in
public-keys)
_wanted public-keys expl 'public key' \
compadd ${${(Mo)$(_call_program public-keys gpg --list-keys 2>/dev/null):%<*>}//(<|>)/} && return
compadd ${${(Mo)$(_call_program public-keys gpg $needed --list-keys 2>/dev/null):%<*>}//(<|>)/} && return
;;
secret-keys)
_wanted secret-keys expl 'secret key' compadd \
${${(Mo)$(_call_program secret-keys gpg --list-secret-keys 2>/dev/null):%<*>}//(<|>)/} && return
${${(Mo)$(_call_program secret-keys gpg $needed --list-secret-keys 2>/dev/null):%<*>}//(<|>)/} && return
;;
ciphers)
_wanted ciphers expl cipher compadd \
${${(s.,.)${(M)${(f)"$(_call_program ciphers gpg --version)"}:#Cipher*}#*:}# } && return
${${(s.,.)${(M)${(f)"$(_call_program ciphers gpg $needed --version)"}:#Cipher*}#*:}# } && return
;;
esac