diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-14 21:29:17 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-14 21:29:17 +1200 |
commit | cc308cf2b396249da58a897e40e5c829de4c4d78 (patch) | |
tree | 76c109e485e59d98e9b1a83f106e2ad7d1d7656c /bin/dmp | |
parent | Merge branch 'master' into freebsd (diff) | |
parent | git push.default from "matching" to "current" (diff) | |
download | dotfiles-cc308cf2b396249da58a897e40e5c829de4c4d78.tar.gz dotfiles-cc308cf2b396249da58a897e40e5c829de4c4d78.zip |
Merge branch 'master' into freebsd
Diffstat (limited to 'bin/dmp')
-rwxr-xr-x | bin/dmp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/dmp b/bin/dmp new file mode 100755 index 00000000..9ef58f67 --- /dev/null +++ b/bin/dmp @@ -0,0 +1,28 @@ +#!/bin/sh + +# Get the password store directory, bail if we can't +pwsd=${PASSWORD_STORE_DIR:-$HOME/.password-store} +pwsd=${pwsd%/} +[ -n "$pwsd" ] || exit + +# Get the password; get all the names from find(1) +pw=$( + cd -- "$pwsd" || exit + # Get all the names from find(1) + find ./ -name \*.gpg | + # Sort them + sort | + # Strip the leading directory and the trailing .gpg + sed ' +s_^\./__ +s_\.gpg$__ + ' | + # Use dmenu(1) to prompt the user to select one + dmenu +) || exit + +# Bail if we don't have a password +[ -n "$pw" ] || exit + +# Pump the password into the clipboard xsel(2); allow 10 seconds +pass show "$pw" | xsel -ibt 10000 |