diff options
author | lassulus <git@lassul.us> | 2023-03-25 09:02:04 +0100 |
---|---|---|
committer | lassulus <git@lassul.us> | 2023-03-25 09:02:04 +0100 |
commit | 2c80bbb28362fd442ad73ffbcf36796105bf9ae9 (patch) | |
tree | c05e424c83a2f4df13ab8888bd680d3dbef9c259 /tv/5pkgs/simple | |
parent | e1df63807bd97209535319e573ebe9200103095d (diff) | |
parent | 18b7ea4675e69fd564604a845bb60db3794e3042 (diff) |
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'tv/5pkgs/simple')
-rwxr-xr-x | tv/5pkgs/simple/fzmenu/bin/otpmenu | 11 | ||||
-rwxr-xr-x | tv/5pkgs/simple/fzmenu/bin/passmenu | 12 | ||||
-rw-r--r-- | tv/5pkgs/simple/fzmenu/default.nix | 6 |
3 files changed, 19 insertions, 10 deletions
diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu index 12bd60a9d..273a408e6 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 \ diff --git a/tv/5pkgs/simple/fzmenu/bin/passmenu b/tv/5pkgs/simple/fzmenu/bin/passmenu index da8e739ee..76153f53e 100755 --- a/tv/5pkgs/simple/fzmenu/bin/passmenu +++ b/tv/5pkgs/simple/fzmenu/bin/passmenu @@ -10,14 +10,18 @@ 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 '*/*.gpg' | \ - sed ' - /\/otp\.gpg$:/d - s/\.gpg$// + find -L "$PASSWORD_STORE_DIR" -type f -name '*.gpg' | + awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" ' + { n = length(PASSWORD_STORE_DIR "/") } + $NF == "otp.gpg" { next } + /.*\.gpg$/ { + print substr($0, 1 + n, length($0)-length(".gpg")-n) + } ' | exec fzf \ --history=/dev/null \ diff --git a/tv/5pkgs/simple/fzmenu/default.nix b/tv/5pkgs/simple/fzmenu/default.nix index 7e19505c1..1a285ee99 100644 --- a/tv/5pkgs/simple/fzmenu/default.nix +++ b/tv/5pkgs/simple/fzmenu/default.nix @@ -21,8 +21,9 @@ pkgs.runCommand "fzmenu" { --replace '#PATH=' PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.dash + pkgs.findutils pkgs.fzf - pkgs.gnused + pkgs.gawk (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) @@ -36,8 +37,9 @@ pkgs.runCommand "fzmenu" { --replace '#PATH=' PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.dash + pkgs.findutils pkgs.fzf - pkgs.gnused + pkgs.gawk (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) |