From 8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 14 Aug 2016 18:29:38 +1200 Subject: Add dmp(1) --- bin/dmp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 bin/dmp (limited to 'bin') 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 -- cgit v1.2.3