From: Doron Behar <doron.behar@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] _gpg: Use explicit UIDs for state = public keys.
Date: Sat, 23 Jun 2018 20:26:37 +0300 [thread overview]
Message-ID: <20180623172637.tt5xittrjfjhwboc@NUC.doronbehar.com> (raw)
In-Reply-To: <20180618194748.4676-1-doron.behar@gmail.com>
Hey guys, is this patch O.K? Can we merge it please? I've been waiting a
while for a response now, it'll be great to get some feedback.
On Mon, Jun 18, 2018 at 10:47:48PM +0300, doron.behar@gmail.com wrote:
> From: Doron Behar <doron.behar@gmail.com>
>
> Use the `--with-colons` option and parse the output according to the
> format specified in the documentation.
> ---
> Completion/Unix/Command/_gpg | 62 ++++++++++++++++++++++++++++++++----
> 1 file changed, 55 insertions(+), 7 deletions(-)
>
> diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
> index 48a36eff2..b35693d1f 100644
> --- a/Completion/Unix/Command/_gpg
> +++ b/Completion/Unix/Command/_gpg
> @@ -206,20 +206,68 @@ fi
>
> case "$state" in
> public-keys)
> - _wanted public-keys expl 'public key' \
> - compadd ${${(Mo)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
> + local public_keys_lines=(${(f)"$(_call_program public-keys ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)"})
> + local -a uids emails
> + local i j parts current_uid
> + for (( i = 1; i < ${#public_keys_lines[@]}; ++i )); do
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + if [[ ${parts[1]} == "fpr" ]]; then
> + current_uid="${parts[10]}"
> + i=$((i + 1))
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + while [[ ${parts[1]} == "uid" ]]; do
> + uids+=("${current_uid}")
> + emails+=("${parts[10]}")
> + i=$((i + 1))
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + done
> + fi
> + done
> + _describe -t public-keys 'public key' emails uids
> ;;
> secret-keys)
> - _wanted secret-keys expl 'secret key' compadd \
> - ${${(Mo)$(_call_program secret-keys $words[1] $needed --list-secret-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
> + local secret_keys_lines=(${(f)"$(_call_program secret-keys ${(q)words[1]} ${(q)needed} --list-secret-keys --list-options no-show-photos --with-colons)"})
> + local -a uids emails
> + local i j parts current_uid
> + for (( i = 1; i < ${#secret_keys_lines[@]}; ++i )); do
> + parts=("${(@s.:.)secret_keys_lines[$i]}")
> + if [[ ${parts[1]} == "fpr" ]]; then
> + current_uid="${parts[10]}"
> + i=$((i + 1))
> + parts=("${(@s.:.)secret_keys_lines[$i]}")
> + while [[ ${parts[1]} == "uid" ]]; do
> + uids+=("${current_uid}")
> + emails+=("${parts[10]}")
> + i=$((i + 1))
> + parts=("${(@s.:.)secret_keys_lines[$i]}")
> + done
> + fi
> + done
> + _describe -t secret-keys 'secret key' emails uids
> ;;
> ciphers)
> _wanted ciphers expl cipher compadd \
> - ${${(s.,.)${(M)${(f)${"$(_call_program ciphers $words[1] $needed --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return
> + ${${(s.,.)${(M)${(f)${"$(_call_program ciphers ${(q)words[1]} ${(q)needed} --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return
> ;;
> (public-keyids)
> - _wanted public-keys expl 'public keyid' \
> - compadd ${(M)${${(f)"$(_call_program public-keyids $words[1] $needed --list-public-keys --list-options no-show-photos)"}## #}:#[0-9A-F](#c40)} && return
> + local public_keys_lines=(${(f)"$(_call_program public-keyids ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)"})
> + local -a uids emails
> + local i j parts current_uid
> + for (( i = 1; i < ${#public_keys_lines[@]}; ++i )); do
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + if [[ ${parts[1]} == "fpr" ]]; then
> + current_uid="${parts[10]}"
> + i=$((i + 1))
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + while [[ ${parts[1]} == "uid" ]]; do
> + uids+=("${current_uid}")
> + emails+=("${parts[10]}")
> + i=$((i + 1))
> + parts=("${(@s.:.)public_keys_lines[$i]}")
> + done
> + fi
> + done
> + _describe -t public-keyids 'public key' emails uids
> ;;
> (option-list)
> _sequence _wanted options expl option \
> --
> 2.17.1
>
next prev parent reply other threads:[~2018-06-23 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 19:47 doron.behar
2018-06-23 17:26 ` Doron Behar [this message]
2018-06-28 13:43 ` Doron Behar
2018-07-01 16:44 ` Daniel Shahaf
-- strict thread matches above, loose matches on Subject: below --
2018-06-07 14:48 doron.behar
2018-06-09 18:21 ` Daniel Shahaf
2018-06-09 18:59 ` Doron Behar
2018-06-09 19:23 ` Daniel Shahaf
2018-06-09 19:41 ` Doron Behar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180623172637.tt5xittrjfjhwboc@NUC.doronbehar.com \
--to=doron.behar@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).