commit 7868f099d8b5894cdd328c99ed18cb318e70026a parent ced60407cad964028ca40d0abfc50d373a1b7521 Author: Bharatvaj H <bharatvaj@yahoo.com> Date: Sun, 29 Aug 2021 19:46:05 +0530 Partially working passfind added Diffstat:
M | .gitignore | | | 1 | + |
A | .local/bin/passfind | | | 21 | +++++++++++++++++++++ |
2 files changed, 22 insertions(+), 0 deletions(-)
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 +