summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/vlt21
1 files changed, 21 insertions, 0 deletions
diff --git a/.local/bin/vlt b/.local/bin/vlt
new file mode 100755
index 0000000..5ef64ce
--- /dev/null
+++ b/.local/bin/vlt
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+[ $# -ne 0 ] && {
+ echo "Usage: ${0##*/}" >&2
+ exit 1
+}
+
+: ${vault:="${XDG_DATA_HOME:-$HOME/.local/share}/vault"}
+[ -d "$vault" ] || mkdir -p "$vault"
+cd "$vault"
+
+# We use ‘*’ instead of ‘.’ to avoid the leading ‘./’
+choice="`find * -type f | osel`"
+password="`enchive extract "$choice" /dev/stdout`"
+[ -n "$password" ] \
+ && { printf '%s' "$password" | wl-copy -no; } \
+ && notify-send -a "${0##*/}" -u normal \
+ 'Password copied to the clipboard' \
+ "The password for ‘$choice’ was copied to the clipboard."