aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kohlstedde <christian@kohlsted.de>2020-07-22 22:37:28 +0200
committerChristian Kohlstedde <christian@kohlsted.de>2020-07-22 22:57:50 +0200
commit546200bf0b250af92e893533e495254b17f40c57 (patch)
treee656e1e9559a3685f701bbaac30650cc87198333
parenta201b04125a5b7b020b9d2010f8791cc810c33bb (diff)
downloadrofi-pass-546200bf0b250af92e893533e495254b17f40c57.tar.gz
Fix password listing regression (#179)
-rw-r--r--README.md1
-rwxr-xr-xrofi-pass20
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 "$@"
-