aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-08-13 19:44:57 +0200
committerRasmus Steinke <rasi@xssn.at>2015-08-13 19:44:57 +0200
commit54bead78eb62260b219a177f533ddaab376c75ab (patch)
tree4ae930f63e64858bf312e72c1b5c4e6308502f35
parenta6dec2799482c30bc278237b27a3e5d73d6e3890 (diff)
downloadrofi-pass-54bead78eb62260b219a177f533ddaab376c75ab.tar.gz
fix colons in fields
-rwxr-xr-xrofi-pass19
1 files changed, 11 insertions, 8 deletions
diff --git a/rofi-pass b/rofi-pass
index a7fcb42..d6ec003 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -68,9 +68,9 @@ doClip () {
# main Menu
mainMenu () {
- HELP="<span color='$help_color'>${autotype}: Autotype | ${type_user}: Type User | ${type_pass}: Type Password
-${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Password | ${show}: Show Entry</span>"
- selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | _rofi -mesg "${HELP}" -dmenu -kb-custom-1 "${autotype}" -kb-custom-2 "${type_user}" -kb-custom-3 "${type_pass}" -kb-custom-4 "${open_url}" -kb-custom-5 "${copy_name}" -kb-custom-6 "${copy_pass}" -kb-custom-7 "${show}" -dmenu -select "$entry" -p "rofi-pass > ")"
+ HELP="<span color='$help_color'>${autotype}: Autotype, ${type_user}: Type User, ${type_pass}: Type Password, ${open_url}: Open URL
+${copy_name}: Copy Username, ${copy_pass}: Copy Password, ${copy_url}: Copy URL, ${show}: Show Entry</span>"
+ selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | _rofi -mesg "${HELP}" -dmenu -kb-custom-1 "${autotype}" -kb-custom-2 "${type_user}" -kb-custom-3 "${type_pass}" -kb-custom-4 "${open_url}" -kb-custom-5 "${copy_name}" -kb-custom-6 "${copy_pass}" -kb-custom-7 "${show}" -kb-custom-8 "${copy_url}" -dmenu -select "$entry" -p "rofi-pass > ")"
rofi_exit=$?
if [[ -n $selected_password ]]; then
@@ -78,7 +78,7 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
echo "$selected_password" > "$HOME/.config/rofi-pass/last_used"
fi
- if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "URL: " | awk -F 'URL: ' '{ print $2 }')"; exit;
+ if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | awk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};
elif [[ "${rofi_exit}" -eq 10 || "${rofi-exit}" -eq 0 ]]; then true
fi
@@ -90,7 +90,7 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
while read LINE; do
_id=$(echo "${LINE}" | awk -F':[[:space:]]*' '{print $1}')
- _val=$(echo "${LINE}" | awk -F':[[:space:]]*' '{print $2}')
+ _val=$(echo "${LINE}" | awk '{sub(/:/,"")}{print $2}1' | head -1)
stuff["${_id}"]=${_val}
done < <(pass "${selected_password}" | tail -n+2 | grep ': ')
stuff["pass"]=${password}
@@ -104,6 +104,9 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
elif [[ $rofi_exit -eq 14 ]]; then
echo -n "${stuff[${USERNAME_field}]}" | doClip
exit
+ elif [[ $rofi_exit -eq 17 ]]; then
+ echo -n "${stuff[${URL_field}]}" | doClip
+ exit
elif [[ $rofi_exit -eq 16 ]]; then
showEntry "${selected_password}"
elif [[ $rofi_exit -eq 15 ]]; then
@@ -111,7 +114,7 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds"
$(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
exit
- elif [[ $rofi_exit -eq 17 || $rofi_exit -eq 18 || $rofi_exit -eq 19 ]]; then
+ elif [[ $rofi_exit -eq 18 || $rofi_exit -eq 19 ]]; then
mainMenu
fi
if [[ "$selected_password" == "[ Add Entry ]>" ]]; then
@@ -265,9 +268,9 @@ insertPass () {
fi
group=$(find -type d -not -iwholename '*.git*' -printf '%d\t%P\n' | sort -r -nk1 | cut -f2- | _rofi -dmenu -p "Choose Group > ")
if [[ -n "$root" ]]; then
- pass insert -m -f "${root}/${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}")
+ pass insert -m -f "${root}/${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\n${URL_field}: ${domain}")
else
- pass insert -m -f "${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}")
+ pass insert -m -f "${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\n${URL_field}: ${domain}")
fi
elif [[ $menu == "1 Name"* ]]; then
name=$(echo "" | _rofi -dmenu -p "Enter Name > ")