diff --git a/rofi-pass b/rofi-pass index 1306593..db427dd 100755 --- a/rofi-pass +++ b/rofi-pass @@ -4,13 +4,6 @@ # (c) 2015 Rasmus Steinke basecommand=$(echo "$0" | gawk '{ print $1 }') -case "$OSTYPE" in - *bsd*) GREP='/usr/local/bin/grep' ;; - linux*) GREP='/usr/bin/grep' ;; - darwin*) GREP='/usr/bin/ggrep' ;; - *) echo 'OS not supported, patches welcome' && exit 1 ;; -esac - # get all password files and create an array list_passwords() { cd "${root}" || exit @@ -80,7 +73,7 @@ autopass () { openURL () { checkIfPass - $BROWSER "$(pass "$selected_password" | $GREP "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit; + $BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit; clearUp } @@ -220,12 +213,13 @@ Type field of entry with Enter. For more help h # generate Array of fields password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password") password="${password_temp%%$'\n'*}" + pass_key_value=$(echo "${password_temp}" | tail -n+2 | grep ': ' | while read line; do echo "${line%%: *}: ${line#* }"; done) declare -A stuff while read -r LINE; do _id="${LINE%%: *}" _val="${LINE#* }" stuff["${_id}"]=${_val} - done < <(echo "${password_temp}" | tail -n+2 | $GREP -P '(: |:\t)' ) + done < <(echo "${pass_key_value}") stuff["pass"]=${password} if test "${stuff['autotype']+autotype}" then @@ -234,6 +228,7 @@ Type field of entry with Enter. For more help h stuff["autotype"]="user :tab pass" fi fi + pass_content="$(for key in "${!stuff[@]}"; do echo "${key}: ${stuff[$key]}"; done)" # actions based on keypresses if [[ "${rofi_exit}" -eq 0 ]]; then typeMenu; @@ -339,63 +334,26 @@ actionMenu () { } showEntry () { - HELP="${type_entry}: Type Entry | ${copy_entry}: Copy Entry" - bla=$({ echo -e "< Return\n---"; PASSWORD_STORE_DIR="${root}" pass "$selected_password";} | _rofi -kb-accept-entry '!Return' -dmenu -mesg "${HELP}" -p "> ") + HELP="${copy_entry}: Copy Entry" + bla=$(echo -e "${pass_content}" | _rofi -kb-accept-entry '!Return' -dmenu -mesg "${HELP}" -p "> ") rofi_exit=$? - password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password") - password=$(echo "${password_temp}" | head -1) - declare -A stuff - - while read -r LINE; do - _id=$(echo "${LINE}" | gawk -F ':[[:space:]]*' '{print $1}') - _val=$(echo "${LINE}" | gawk '{sub(/:/,"")}{for (i=2; i