From c8eaed87b1351038b7f21b1466288b1a358d2af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Wed, 7 Nov 2012 00:15:22 +0100 Subject: Small changes to our pass wrapper --- .zsh/functions/pass | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to '.zsh') diff --git a/.zsh/functions/pass b/.zsh/functions/pass index 4c8f5e0..ad78018 100644 --- a/.zsh/functions/pass +++ b/.zsh/functions/pass @@ -40,7 +40,7 @@ clip() { qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null echo "$before" | base64 -d | xclip -selection clipboard - ) & disown + ) &! echo "Copied $2 to clipboard. Will clear in 45 seconds." } @@ -72,10 +72,19 @@ if [[ $ppath == "-c" || $ppath == "--clip" ]]; then ppath=$2 fi -entry="$(command pass show $ppath | grep "$subcmd:" | sed -e "s/^$subcmd: //")" +entry="$(command pass show $ppath)" +ret=$? +if [[ $ret -ne 0 ]]; then + # entry not found + echo $entry + return $ret +fi + +entry="$(echo $entry | grep "$subcmd:" | sed -e "s/^$subcmd: //")" if [[ -z $entry ]]; then echo "No '$subcmd:' entry found" + return 11 else if [[ -n $xclip ]]; then clip "$entry" "entry of $ppath" -- cgit v1.2.3