aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-15 17:11:31 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-15 17:11:31 +1200
commit85163378bca88d16c5629009e4ab43a621fbe57c (patch)
treef2486557df78798a3272293a7cc899ecabdf1cf4
parentAdjust wrapping in dmp(1) man page (diff)
downloaddotfiles-85163378bca88d16c5629009e4ab43a621fbe57c.tar.gz
dotfiles-85163378bca88d16c5629009e4ab43a621fbe57c.zip
Allow timeout argument to dmp(1)
-rwxr-xr-xbin/dmp5
-rw-r--r--man/man1/dmp.17
2 files changed, 10 insertions, 2 deletions
diff --git a/bin/dmp b/bin/dmp
index b6c878f9..d25082dd 100755
--- a/bin/dmp
+++ b/bin/dmp
@@ -1,5 +1,8 @@
#!/bin/sh
+# Sole optional argument is the password timeout (defaults to 10 seconds)
+timeout_sec=${1:-10}
+
# Get the password store directory, bail if we can't
pwsd=${PASSWORD_STORE_DIR:-$HOME/.password-store}
pwsd=${pwsd%/}
@@ -23,4 +26,4 @@ pw=$(
[ -n "$pw" ] || exit
# Pump the password into the clipboard xsel(2); allow 10 seconds
-pass show "$pw" | xsel -ibt 10000
+pass show "$pw" | xsel -ibt "$((timeout_sec * 1000))"
diff --git a/man/man1/dmp.1 b/man/man1/dmp.1
index 78fa8ec8..4cb354f0 100644
--- a/man/man1/dmp.1
+++ b/man/man1/dmp.1
@@ -4,11 +4,16 @@
\- pick a pass(1) password with dmenu(1)
.SH SYNOPSIS
.B dmp
+.br
+.B dmp 25
.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.
+.P
+An optional timeout in seconds can be applied, after which xsel(1) will remove
+the password from the clipboard. This timeout defaults to 10 seconds.
.SH SEE ALSO
-dmenu(1), pass(1)
+dmenu(1), pass(1), xsel(1)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>