[pass] [PATCH 5/5] use gpg --batch for quieter output

Brian Mattern rephorm at rephorm.com
Thu Sep 13 07:25:20 CEST 2012


I don't know if this is ideal for everyone here, but I thought I'd send
this for discussion.

Right now, every time I call pass to decrypt a key, I get output like:

  You need a passphrase to unlock the secret key for
  user: "User Name <user at domain.com>"
  2048-bit ELG-E key, ID XXXXXXNX, created 2012-04-20 (main key ID NNXXNNNX)
  password

This patch cleans it up so that only the password is output. I use
pinentry-gtk-2 to enter the gpg passphrase, so this information is
redundant to me. I haven't tried other pinentry versions to see if they
repeat the information as well.

Maybe we can break out the common gpg flags (-q --yes --batch) into a
separate variable (possibly overridden by an env var?)

---
 src/password-store.sh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index e21ec69..f4af11c 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -160,9 +160,9 @@ case "$command" in
 				exit 1
 			fi
 			if [ $clip -eq 0 ]; then
-				exec gpg -q -d --yes "$passfile"
+				exec gpg -q -d --yes --batch "$passfile"
 			else
-				clip "$(gpg -q -d --yes "$passfile" | head -n 1)" "$path"
+				clip "$(gpg -q -d --yes --batch "$passfile" | head -n 1)" "$path"
 			fi
 		fi
 		;;
@@ -260,7 +260,7 @@ case "$command" in
 
 		action="Added"
 		if [[ -f $passfile ]]; then
-			gpg -q -d -o "$tmp_file" --yes "$passfile" || exit 1
+			gpg -q -d -o "$tmp_file" --yes --batch "$passfile" || exit 1
 			action="Edited"
 		fi
 		${EDITOR:-vi} "$tmp_file"
-- 
1.7.9.5





More information about the Password-Store mailing list