summaryrefslogtreecommitdiff
path: root/bin/guiscripts/fillpass
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-15 00:33:26 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-15 00:33:26 +0200
commit826ce094fecc4c6e07faf6e8b91387c2ae49842c (patch)
tree1820c843e4e260f6b51e8d269a972295a17e558c /bin/guiscripts/fillpass
parentc032a9d071ee4b7eb2bfe79ec03d2a7dc4020f15 (diff)
parenta915b5ade1a47b9678e2f9963b13b49dbd406031 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/guiscripts/fillpass')
-rwxr-xr-xbin/guiscripts/fillpass15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/guiscripts/fillpass b/bin/guiscripts/fillpass
new file mode 100755
index 0000000..358afd1
--- /dev/null
+++ b/bin/guiscripts/fillpass
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+pass="$(
+ find "${PASSWORD_STORE_DIR:=~/src/password-store/}" -name "*.gpg" |
+ sed -e "s@$PASSWORD_STORE_DIR/@@" -e 's/\.gpg$//' |
+ commander -x -c)"
+[ "$pass" ] || exit 1
+
+login="$(pass show "$pass" | awk '/^login:/ {print $2}')"
+password="$(pass show "$pass" | head -n 1)"
+
+if [ "$login" ]
+then printf '%s\t%s\n' "$login" "$password" | ydotool type -f -
+else printf '%s\n' "$password" | ydotool type -f -
+fi