From 80f67c3e6c39780fa0897683340a77a9a85bf5e4 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Tue, 2 Jun 2015 20:20:44 +0200 Subject: [PATCH] put show in its own function --- rofi-pass | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/rofi-pass b/rofi-pass index 52c30fb..f385fd7 100755 --- a/rofi-pass +++ b/rofi-pass @@ -72,13 +72,7 @@ mainMenu () { elif [[ "${rofi_exit}" -eq 11 ]]; then manageEntry move; elif [[ "${rofi_exit}" -eq 1 ]]; then exit; elif [[ "${rofi_exit}" -eq 12 ]]; then manageEntry delete; - elif [[ "${rofi_exit}" -eq 13 ]]; then - menu=$(echo -e "0 Return to Manage Menu\n---\n$(pass "$selected_password")" | rofi -dmenu -p "> ") - if [[ $menu == "0 Return to Manage Menu" ]]; then mainMenu manage - elif [[ $menu == "" ]]; then exit - else - : - fi + elif [[ "${rofi_exit}" -eq 13 ]]; then showEntry; fi if [[ "$selected_password" == "0 Return to Main Menu" ]]; then mainMenu @@ -164,6 +158,15 @@ Alt+4: Open URL | Alt+c: Copy Username | Alt+Shift+c: Copy Password" unset stuff } +showEntry () { + menu=$(echo -e "0 Return to Manage Menu\n---\n$(pass "$selected_password")" | rofi -dmenu -p "> ") + if [[ $menu == "0 Return to Manage Menu" ]]; then mainMenu manage + elif [[ $menu == "" ]]; then exit + else + showEntry + fi +} + manageEntry () { if [[ "$1" == "edit" ]]; then EDITOR=$EDITOR pass edit "${selected_password}"