aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-10-10 15:41:08 +0200
committerPatrick Spek <p.spek@tyil.nl>2019-10-10 15:41:08 +0200
commit9a619c5ed3e91d2e356097e805267eeb19f4b3b4 (patch)
treea56643b6f4977f1ff63c2e30b56791f469755056
parentf2f3dfa74f09b7560adbfe5d761287062be78bd1 (diff)
Add lastpass-cli wrapper
-rw-r--r--.gitignore1
-rwxr-xr-x.local/bin/lpass21
2 files changed, 22 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e4264cd..ad9d661 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,7 @@
!/.local/bin/chomp
!/.local/bin/chwp
!/.local/bin/kubecontext
+!/.local/bin/lpass
!/.local/bin/mkbak
!/.local/bin/mkpasswd
!/.local/bin/ta
diff --git a/.local/bin/lpass b/.local/bin/lpass
new file mode 100755
index 0000000..1362ad1
--- /dev/null
+++ b/.local/bin/lpass
@@ -0,0 +1,21 @@
+#! /usr/bin/env sh
+
+readonly BIN=/usr/bin/lpass
+
+main()
+{
+ # Password is stored in pass, read it from there when trying to login
+ if [ "$1" = "login" ]
+ then
+ export LPASS_DISABLE_PINENTRY=1
+ shift
+
+ pass show "websites/lastpass.com/$1" | "$BIN" login --trust "$@"
+ return
+ fi
+
+ # Hand off execution to the regular binary
+ exec "$BIN" "$@"
+}
+
+main "$@"