add check for add pass entry

This commit is contained in:
Rasmus Steinke 2015-11-14 15:01:39 +01:00
parent 6327ba5a82
commit d2e6f2eda2

View File

@ -169,16 +169,20 @@ ${line3}</span>"
rofi_exit=$? rofi_exit=$?
# generate Array of fields if [[ ${selected_password} == "[ Add Entry ]>" ]]; then
password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password") :
password=$(echo "${password_temp}" | head -1) else
declare -A stuff # generate Array of fields
while read LINE; do password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
_id=$(echo -e "${LINE}" | awk -F ':[[:space:]]*' '{print $1}') password=$(echo "${password_temp}" | head -1)
_val=$(echo -e "${LINE}" | awk '{sub(/:/,"")}{for (i=2; i<NF; i++) printf $i " "; print $NF}') declare -A stuff
stuff["${_id}"]=${_val} while read LINE; do
done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' ) _id=$(echo -e "${LINE}" | awk -F ':[[:space:]]*' '{print $1}')
stuff["pass"]=${password} _val=$(echo -e "${LINE}" | awk '{sub(/:/,"")}{for (i=2; i<NF; i++) printf $i " "; print $NF}')
stuff["${_id}"]=${_val}
done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' )
stuff["pass"]=${password}
fi
# actions based on keypresses # actions based on keypresses
if [[ "${rofi_exit}" -eq 0 ]]; then autopass; if [[ "${rofi_exit}" -eq 0 ]]; then autopass;
@ -193,7 +197,7 @@ ${line3}</span>"
elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass; elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
elif [[ "${rofi_exit}" -eq 22 ]]; then typeMenu; elif [[ "${rofi_exit}" -eq 22 ]]; then typeMenu;
elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu; elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu;
elif [[ "${rofi_exit}" -eq 25 ]]; then helpMenu; elif [[ "${rofi_exit}" -eq 25 ]]; then unset selected_password; helpMenu;
elif [[ "${rofi_exit}" -eq 24 ]]; then copyMenu; elif [[ "${rofi_exit}" -eq 24 ]]; then copyMenu;
fi fi
password='' password=''
@ -206,8 +210,7 @@ ${line3}</span>"
} }
helpMenu () { helpMenu () {
helptext=$(echo -e "${type_user}: Type User helptext=$(echo -e "${autotype}: Autotype
${autotype}: Autotype
${type_user}: Type Username ${type_user}: Type Username
${type_pass}: Type Password ${type_pass}: Type Password
${type_menu}: Type Custom Field ${type_menu}: Type Custom Field