From f9c216d213ecbffe2e0d50a02ea53c4df2290ee7 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 23 Aug 2023 07:37:07 +0300 Subject: vlt: Add ‘vlt’ for password management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local/bin/vlt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .local/bin/vlt 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." -- cgit v1.2.3