dotfiles

Cross platform dotfiles for linux, mac and windows

commit 02c8a8a137dfd23effb9fa0ed7e777ba59a71d31
parent dc3b63827a137b3669e30ff0734eab6a1427200a
Author: Bharatvaj H <bharatvaj@yahoo.com>
Date: Sun, 29 Aug 2021 19:46:05 +0530

Partially working passfind added
2 files changed, 22 insertions(+), 0 deletions(-)
M
.gitignore
|
1
+
A
.local/bin/passfind
|
21
+++++++++++++++++++++
diff --git a/.gitignore b/.gitignore
@@ -15,5 +15,6 @@
 !.config/
 
 # Local shell scripts
+!.local/
 !.local/bin/
 !.local/bin/*
diff --git a/.local/bin/passfind b/.local/bin/passfind
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Adapted from https://gist.github.com/heywoodlh/4c1e27f477a896bc3b0f6d55e2748d26
+
+## Assumes that the user is using otp plugin
+## Install fzf and make sure pass is configured beforehand
+
+## If you want to grab the totp code, use like so: `pass-fzf.sh otp`, otherwise script will assume you want password
+
+type="${1}"
+
+PASS_DIR=${XDG_DATA_HOME}/pass
+selection="$(find -L ${PASS_DIR} -name '*.gpg' -exec  realpath --relative-to=${PASS_DIR}  {} | sed -e 's/.gpg//' | fzf --layout=reverse)"
+
+if [ "${type}" == "otp" ]
+then
+	pass otp show "${selection}"
+else
+	pass show "${selection}"
+fi
+