summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/simple/fzmenu/bin/otpmenu
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-03-22 18:04:21 +0100
committertv <tv@krebsco.de>2023-03-22 18:04:21 +0100
commit2186f0dc3a35400e9bd529c707ba74741b4a923f (patch)
treeccf0540a674a3dbe3ccb50dcc150eaec7b49ed06 /tv/5pkgs/simple/fzmenu/bin/otpmenu
parentcc8480f754039d416fac22a38e8218a2cb107b50 (diff)
tv fzmenu: admit symlinks
Diffstat (limited to 'tv/5pkgs/simple/fzmenu/bin/otpmenu')
-rwxr-xr-xtv/5pkgs/simple/fzmenu/bin/otpmenu11
1 files changed, 7 insertions, 4 deletions
diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu
index 12bd60a..273a408 100755
--- a/tv/5pkgs/simple/fzmenu/bin/otpmenu
+++ b/tv/5pkgs/simple/fzmenu/bin/otpmenu
@@ -10,14 +10,17 @@ case ${FZMENU_PHASE-0} in
;;
1)
if result=$(
+ PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR-$HOME/.password-store}
FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-}
if test -n "$FZF_DEFAULT_OPTS"; then
export FZF_DEFAULT_OPTS
fi
- pass git ls-files '*/otp.gpg' | \
- sed '
-
- s/\/otp\.gpg$//
+ find -L "$PASSWORD_STORE_DIR" -type f -name 'otp.gpg' |
+ awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" '
+ { n = length(PASSWORD_STORE_DIR "/") }
+ $NF == "otp.gpg" {
+ print substr($0, 1 + n, length($0)-length("/otp.gpg")-n)
+ }
' |
exec fzf \
--history=/dev/null \