From 4704c050a2990de03d30bdf7c473694411c3c60d Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Wed, 10 May 2017 14:46:54 +1000 Subject: [PATCH] Add pass-unpack zsh function for easily retrieving all fields from a password-store file --- config/zsh/functions/pass-unpack | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config/zsh/functions/pass-unpack diff --git a/config/zsh/functions/pass-unpack b/config/zsh/functions/pass-unpack new file mode 100644 index 0000000..e16986e --- /dev/null +++ b/config/zsh/functions/pass-unpack @@ -0,0 +1,8 @@ +#! zsh +local out=("${(@f)$(echo -n 'password: ' && pass show $1)}") field + +for field in $out; do + field=(${(s/: /)field}) + set -A $2 ${(kv)${(P)2}} $field + # Above is equivalent to $2+=($field) except it's legal syntax ;) +done