zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: doron.behar@gmail.com
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.
Date: Sun, 3 Jun 2018 21:43:50 +0000	[thread overview]
Message-ID: <20180603214350.a247lk4n6lbbz56l@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20180602152651.16904-1-doron.behar@gmail.com>

doron.behar@gmail.com wrote on Sat, Jun 02, 2018 at 18:26:51 +0300:
> From: Doron Behar <doron.behar@gmail.com>
> 
> Use the `--with-colons` option and parse the output.
> ---
>  Completion/Unix/Command/_gpg | 69 ++++++++++++++++++++++++++++++++----
>  1 file changed, 63 insertions(+), 6 deletions(-)
> 
> diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
> index 48a36eff2..7e707c5f6 100644
> --- a/Completion/Unix/Command/_gpg
> +++ b/Completion/Unix/Command/_gpg
> @@ -206,20 +206,77 @@ 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=(${(@s.:.)$(_call_program public-keys eval IFS=$'\n' $words[1] $needed --list-public-keys --list-options no-show-photos --with-colons)})

This isn't quite right.

The first argument to «eval» here is the five bytes «IFS=\n» (where \n stands
for an 0x0A byte), so the eval'd code sets IFS to the empty string, not to the
one-byte string $'\n', and the assignment isn't specific to the command either.

I'm not sure what value you _meant_ to set IFS to.  If you meant to set it to a
newline, you could do something like this:

    …$(_call_program public-keys eval IFS=${(q):-$'\n'} ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)…

I also added (q) to the other variable expansions.


  reply	other threads:[~2018-06-03 21:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 15:26 doron.behar
2018-06-03 21:43 ` Daniel Shahaf [this message]
2018-06-05 15:47   ` Doron Behar
2018-06-07  6:40     ` Daniel Shahaf
2018-06-07 15:50       ` Doron Behar
2018-06-09 20:09 doron.behar
2018-06-09 20:39 ` Daniel Shahaf
2018-06-12 10:54   ` Doron Behar
2018-06-12 19:22     ` Matthew Martin
2018-06-12 22:14     ` Phil Pennock
2018-06-13 15:17       ` Doron Behar
2018-06-14 10:06         ` Daniel Shahaf

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=20180603214350.a247lk4n6lbbz56l@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=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).