diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2012-11-07 00:15:22 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2012-11-07 00:15:22 +0100 |
commit | c8eaed87b1351038b7f21b1466288b1a358d2af6 (patch) | |
tree | 0fa887a5fc195228cbc97224f0298e99b2186edf /.zsh/functions/pass | |
parent | 57f728c7e8dec8168eaa5b82947706d1682fc2e9 (diff) | |
download | dotfiles-c8eaed87b1351038b7f21b1466288b1a358d2af6.tar.gz dotfiles-c8eaed87b1351038b7f21b1466288b1a358d2af6.tar.bz2 dotfiles-c8eaed87b1351038b7f21b1466288b1a358d2af6.zip |
Small changes to our pass wrapper
Diffstat (limited to '.zsh/functions/pass')
-rw-r--r-- | .zsh/functions/pass | 13 |
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" |