summaryrefslogtreecommitdiff
path: root/.zsh
diff options
context:
space:
mode:
Diffstat (limited to '.zsh')
-rw-r--r--.zsh/functions/pass13
1 files changed, 11 insertions, 2 deletions
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"