Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/1] _gpg: Use explicit UIDs for state = public keys.
- X-seq: zsh-workers 42854
- From: doron.behar@xxxxxxxxx
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/1] _gpg: Use explicit UIDs for state = public keys.
- Date: Sat, 26 May 2018 18:16:28 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=AMFBq7ZZ9rVWGhxJ63qjq5Te894brlDDGHESXcw/Afc=; b=Xm78iXS5fBOEDMUmvELb6CZ8+WLMt248eq6eSp/l58XYDMVoyfg0YtcbPdtlRnBkJw obWSoIhndKfGSzoPLVR5yZQ17QaUDIhFwwvBwbih5jXtdG7eqk2zEcJYqc+IWM9RBIqp U8KKomNDGiEvjls0dSnS9NXh7vHm/qPAIW+nfDlUI2lVUGBo3ImZlez3PwO3UTRooii5 9cNNYc6FeMH1Hak2Def6gcG0CVIc5OC3deJsO/N8kBhSDmOVrMcmLGpcAADxXTJl5Nqe QZh6KtqL6d/TCMnihox7HdR8hyeq7Ba7OMvUuu3F0mPKRhs9RPBgMD+fAXam5KHf8zLJ dv0A==
- In-reply-to: <20180526151628.17983-1-doron.behar@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180526151628.17983-1-doron.behar@gmail.com>
From: Doron Behar <doron.behar@xxxxxxxxx>
Use the `--with-colons` option and parse the output while IFS=":"
according to the output format.
---
Completion/Unix/Command/_gpg | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
index 48a36eff2..71fa7667d 100644
--- a/Completion/Unix/Command/_gpg
+++ b/Completion/Unix/Command/_gpg
@@ -206,8 +206,19 @@ 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
+ OLDIFS="${IFS}"
+ IFS=":"
+ public_keys=($($words[1] $needed --list-public-keys --list-options no-show-photos --with-colons))
+ for i in {1..${#public_keys[@]}}; do
+ if [[ ${public_keys[$i]} =~ "fpr" ]] && [[ ${public_keys[$((i + 19))]} =~ "@" ]] ; then
+ # +9 is the uid
+ # +19 is the description
+ uids_and_emails+=(${public_keys[$((i + 9))]}":"${public_keys[$((i + 19))]})
+ i=$((i+20))
+ fi
+ done
+ _describe uids uids_and_emails
+ IFS="${OLDIFS}"
;;
secret-keys)
_wanted secret-keys expl 'secret key' compadd \
--
2.17.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author