summary refs log tree commit diff
path: root/bin/kp
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-18 17:52:21 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:38:21 +0100
commit273f57260449a8247eb1e7ca640dba6af8a90ad2 (patch)
tree14d364dbe3c8eb7599f802a61e1f617ddfcdf111 /bin/kp
parent7a7ef68421ceb67642560ee00d0c51301934f3c0 (diff)
bin: drop some scripts
chrome-extension-dl
fs
kp
mesoninit
once
open
wsudo
Diffstat (limited to 'bin/kp')
-rwxr-xr-xbin/kp75
1 files changed, 0 insertions, 75 deletions
diff --git a/bin/kp b/bin/kp
deleted file mode 100755
index f578b04..0000000
--- a/bin/kp
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-
-set -e -o pipefail
-
-KP="$HOME/.local/bin/KeePassXC-2.5.1-x86_64.AppImage"
-[ -e "$KP" ] || {
-    echo "$KP not found" >&2; exit 1
-}
-
-DB="${KP_DB:-$HOME/Dropbox/keepass-box.kdbx}"
-[ -e "$DB" ] || {
-    echo "$DB not found" >&2; exit 1
-}
-
-keepass()
-{
-    "$KP" $@
-}
-
-wofi()
-{
-    wofi -k /dev/null --dmenu --prompt 'Select an entry'
-}
-
-unset passwd
-passwd="$(ASKPASS_PROMPT='Enter KeePassXC password' askpass)"
-[ -n "$passwd" ] || {
-    echo "No password" >&2; exit 1
-}
-
-_kp_command=show
-_kp_opts='-q -a Password'
-_kp_extra_args=
-case $1 in
-    clip)
-        _kp_command='clip'
-        _kp_opts='-q'
-        _kp_extra_args='15' # timeout
-        shift
-        ;;
-    dump)
-        echo "$passwd" | keepass cli export -f csv "$DB"
-        exit 0
-        ;;
-esac
-
-entry="$1"
-[ -n "$entry" ] || {
-    entry=$(echo "$passwd" \
-        | keepass cli ls -q -R "$DB" \
-        | awk '
-{
-    if ($0~/\/$/) { 
-        sub(/^\s+/, "")
-        if ($0!~/^\s+/) {
-            grp = $0
-        } else {
-            print substr($0, match($0, /^\s+/))
-            grp = grp $0
-        }
-            next 
-    } else { 
-        sub(/^\s+/, "")
-        print "/" grp $0 
-    } 
-}' \
-        | grep -v '^/Recycle Bin' \
-        | sort -t/ -k2n \
-        | wofi)
-    [ -n "$entry" ] || {
-        echo "No entry" >&2; exit 1
-    }
-}
-
-echo "$passwd" | keepass cli "$_kp_command" "$_kp_opts" "$DB" "$entry" "$_kp_extra_args"