From 546200bf0b250af92e893533e495254b17f40c57 Mon Sep 17 00:00:00 2001 From: Christian Kohlstedde Date: Wed, 22 Jul 2020 22:37:28 +0200 Subject: Fix password listing regression (#179) --- README.md | 1 + rofi-pass | 20 ++++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3d1f7a6..fec1ffc 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ in a convenient way using [rofi](https://github.com/DaveDavenport/rofi). * xdotool * gawk * bash 4.x +* find * pwgen * [pass-otp](https://github.com/tadfisher/pass-otp) (optional: for OTPs) diff --git a/rofi-pass b/rofi-pass index 21a14ee..96a3072 100755 --- a/rofi-pass +++ b/rofi-pass @@ -67,12 +67,17 @@ has_qrencode() { command -v qrencode >/dev/null 2>&1 } -# get all password files and create an array +listgpg () { + mapfile -d '' pw_list < <(find -L . -name '*.gpg' -print0) + pw_list=("${pw_list[@]#./}") + printf '%s\n' "${pw_list[@]}" | sort -n +} + +# get all password files and output as newline-delimited text list_passwords() { cd "${root}" || exit - pw_list=($(find -L * -name "*.gpg")) + mapfile -t pw_list < <(listgpg) printf '%s\n' "${pw_list[@]%.gpg}" | sort -n - } doClip () { @@ -678,11 +683,6 @@ manageEntry () { fi } -listgpg () { - pw_list=(**/*.gpg) - printf '%s\n' "${pw_list[@]}" | sort -n -} - insertPass () { url=$(xclip --selection clipboard -o) @@ -805,9 +805,6 @@ get_config_file () { } main () { - # enable extended globbing - shopt -s nullglob globstar - # load config file config_file="$(get_config_file)" [[ ! -z "$config_file" ]] && source "$config_file" @@ -881,4 +878,3 @@ main () { } main "$@" - -- cgit