aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2016-09-10 18:07:20 +0200
committerRasmus Steinke <rasi@xssn.at>2016-09-10 18:07:20 +0200
commitade93e8b72b3eb4ce579bc00bdd76ff32559e7a8 (patch)
tree02d04702ca81fe7707679d08e40a77bd20184df9
parent41d0dbf8cae7e713687e3fcdcb2c769f27934a26 (diff)
downloadrofi-pass-ade93e8b72b3eb4ce579bc00bdd76ff32559e7a8.tar.gz
read password file into array before building fields
-rwxr-xr-xrofi-pass16
1 files changed, 10 insertions, 6 deletions
diff --git a/rofi-pass b/rofi-pass
index 476732d..4f678ff 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -250,18 +250,22 @@ Run ${default_do} with <span color='$help_color'>Enter</span>. For more help hit
exit
fi
# generate Array of fields
- password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
- password="${password_temp%%$'\n'*}"
- fields="$(echo "${password_temp}" | tail -n +2)"
- pass_key_value=$(echo "${fields}" | awk '$1 ~ /:$/{$1=$1;print}')
+# password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
+# password="${password_temp%%$'\n'*}"
+# fields="$(echo "${password_temp}" | tail -n +2)"
+# pass_key_value=$(echo "${fields}" | awk '$1 ~ /:$/{$1=$1;print}')
+ mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
+ password=${password_temp[0]}
+ fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/{$1=$1;print}')
+
declare -A stuff
stuff["pass"]=${password}
- if [[ -n $pass_key_value ]]; then
+ if [[ -n $fields ]]; then
while read -r LINE; do
_id="${LINE%%: *}"
_val="${LINE#* }"
stuff["${_id}"]=${_val}
- done < <(echo "${pass_key_value}")
+ done < <(echo "${fields}")
if test "${stuff['autotype']+autotype}"
then
: