aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-14 18:29:38 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-14 18:29:38 +1200
commit8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d (patch)
tree76c442e5a346498664dabf17c0594d0e1c028003 /bin
parentRecategorise some scripts in README (diff)
downloaddotfiles-8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d.tar.gz
dotfiles-8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d.zip
Add dmp(1)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dmp28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/dmp b/bin/dmp
new file mode 100755
index 00000000..4dd4b444
--- /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
+)
+
+# 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