Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.



Good morning Doron,

Thanks for revising the patch, however, I'm afraid I do have a few more
comments:

doron.behar@xxxxxxxxx wrote on Sat, Jun 09, 2018 at 23:09:40 +0300:
>    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=(${(@s.:.)${(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
> +    for i in {1..${#secret_keys[@]}}; do
> +      if [[ ${secret_keys[$i]} == "fpr" ]]; then

I'd like to see the 'fpr' thing (which I have pointed out twice by now) fixed
before merging.  _gpg isn't a function I'm comfortable adding
relaxed/inaccurate parsing to, and doing the parsing correctly isn't onerous.

> +        i=$((i + 1))
> +        local j=$i
> +        while [[ ${secret_keys[$j]} != "fpr" ]] && [ $j -lt ${#secret_keys[@]} ]; do
> +          if [[ ${secret_keys[$j]} =~ "@" ]]; then

This condition false negatives for me, probably because I used a test secret
key that didn't have an email address attached.

> +            emails+="${secret_keys[$j]}"
> +            uids+="${secret_keys[$i]}"
> +            break
> +          fi
> +          j=$((j + 1))
> +        done
> +        i=$j
> +      fi
> +    done
> +    _describe -t secret-keys 'secret key' uids_and_emails

s/uids_and_emails/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)
> +    _describe -t public-keyids 'public keyids' uids_and_emails

Ditto.

Thanks for hanging in there.

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author