tv fzmenu: admit symlinks

This commit is contained in:
tv 2023-03-22 18:04:21 +01:00
parent d873abf0a9
commit 782c865236
3 changed files with 19 additions and 10 deletions

View File

@ -10,14 +10,17 @@ case ${FZMENU_PHASE-0} in
;; ;;
1) 1)
if result=$( if result=$(
PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR-$HOME/.password-store}
FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-}
if test -n "$FZF_DEFAULT_OPTS"; then if test -n "$FZF_DEFAULT_OPTS"; then
export FZF_DEFAULT_OPTS export FZF_DEFAULT_OPTS
fi fi
pass git ls-files '*/otp.gpg' | \ find -L "$PASSWORD_STORE_DIR" -type f -name 'otp.gpg' |
sed ' awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" '
{ n = length(PASSWORD_STORE_DIR "/") }
s/\/otp\.gpg$// $NF == "otp.gpg" {
print substr($0, 1 + n, length($0)-length("/otp.gpg")-n)
}
' | ' |
exec fzf \ exec fzf \
--history=/dev/null \ --history=/dev/null \

View File

@ -10,14 +10,18 @@ case ${FZMENU_PHASE-0} in
;; ;;
1) 1)
if result=$( if result=$(
PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR-$HOME/.password-store}
FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-}
if test -n "$FZF_DEFAULT_OPTS"; then if test -n "$FZF_DEFAULT_OPTS"; then
export FZF_DEFAULT_OPTS export FZF_DEFAULT_OPTS
fi fi
pass git ls-files '*/*.gpg' | \ find -L "$PASSWORD_STORE_DIR" -type f -name '*.gpg' |
sed ' awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" '
/\/otp\.gpg$:/d { n = length(PASSWORD_STORE_DIR "/") }
s/\.gpg$// $NF == "otp.gpg" { next }
/.*\.gpg$/ {
print substr($0, 1 + n, length($0)-length(".gpg")-n)
}
' | ' |
exec fzf \ exec fzf \
--history=/dev/null \ --history=/dev/null \

View File

@ -21,8 +21,9 @@ pkgs.runCommand "fzmenu" {
--replace '#PATH=' PATH=${lib.makeBinPath [ --replace '#PATH=' PATH=${lib.makeBinPath [
pkgs.coreutils pkgs.coreutils
pkgs.dash pkgs.dash
pkgs.findutils
pkgs.fzf pkgs.fzf
pkgs.gnused pkgs.gawk
(pkgs.pass.withExtensions (ext: [ (pkgs.pass.withExtensions (ext: [
ext.pass-otp ext.pass-otp
])) ]))
@ -36,8 +37,9 @@ pkgs.runCommand "fzmenu" {
--replace '#PATH=' PATH=${lib.makeBinPath [ --replace '#PATH=' PATH=${lib.makeBinPath [
pkgs.coreutils pkgs.coreutils
pkgs.dash pkgs.dash
pkgs.findutils
pkgs.fzf pkgs.fzf
pkgs.gnused pkgs.gawk
(pkgs.pass.withExtensions (ext: [ (pkgs.pass.withExtensions (ext: [
ext.pass-otp ext.pass-otp
])) ]))