aboutsummaryrefslogtreecommitdiff
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
parentRecategorise some scripts in README (diff)
downloaddotfiles-8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d.tar.gz
dotfiles-8df5a7fe4429cdb8afc1bfc5e727f2f19f3d693d.zip
Add dmp(1)
-rw-r--r--README.markdown1
-rwxr-xr-xbin/dmp28
-rw-r--r--man/man1/dmp.115
3 files changed, 44 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index db505be9..191371f4 100644
--- a/README.markdown
+++ b/README.markdown
@@ -349,6 +349,7 @@ Installed by the `install-bin` target:
* `cf(1)` prints a count of entries in a given directory.
* `clrd(1)` sets up a per-line file read, clearing the screen first.
* `clwr(1)` sets up a per-line file write, clearing the screen before each line
+* `dmp(1)` copies a pass(1) entry selected by `dmenu(1)` to the X CLIPBOARD.
* `dub(1)` lists the biggest entries in a directory.
* `edda(1)` provides a means to run `ed(1)` over a set of files preserving
any options, mostly useful for scripts.
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
diff --git a/man/man1/dmp.1 b/man/man1/dmp.1
new file mode 100644
index 00000000..2d9111d6
--- /dev/null
+++ b/man/man1/dmp.1
@@ -0,0 +1,15 @@
+.TH DMP 1 "May 2014" "Manual page for dmp"
+.SH NAME
+.B dmp
+\- pick a pass(1) password with dmenu(1)
+.SH SYNOPSIS
+.B dmp
+.SH DESCRIPTION
+.B dmp
+applies dmenu(1) to pick a password entry
+from a pass(1) store and put it into the X
+CLIPBOARD for up to 10 seconds.
+.SH SEE ALSO
+dmenu(1), pass(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>