diff options
author | Rasmus Steinke <rasi@xssn.at> | 2016-09-10 18:07:20 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2016-09-10 18:07:20 +0200 |
commit | ade93e8b72b3eb4ce579bc00bdd76ff32559e7a8 (patch) | |
tree | 02d04702ca81fe7707679d08e40a77bd20184df9 | |
parent | 41d0dbf8cae7e713687e3fcdcb2c769f27934a26 (diff) | |
download | rofi-pass-ade93e8b72b3eb4ce579bc00bdd76ff32559e7a8.tar.gz |
read password file into array before building fields
-rwxr-xr-x | rofi-pass | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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 : |