From 0f46c638d3bd2772ff20b1094fc73e63b6857783 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Tue, 14 Jul 2015 20:58:23 +0200 Subject: [PATCH] make --root totally optional when not splitting passwords --- rofi-pass | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/rofi-pass b/rofi-pass index 5cca5ca..b7f6731 100755 --- a/rofi-pass +++ b/rofi-pass @@ -26,19 +26,22 @@ fi if [[ -n "$2" ]]; then root="$2" +else + root="" fi -get_root () { - if [[ -n "$2" ]]; then - root="$2" - else - if [[ $(find "$basedir" -maxdepth 1 \( ! -name '.*' \) -type d | wc -l) == "1" ]]; then - root="$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \;)" - else - root=$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \; | rofi -dmenu -p "Choose Database") - fi - fi -} +#get_root () { +# if [[ -n "$2" ]]; then +# root="$2" +# else +# if [[ $(find "$basedir" -maxdepth 1 \( ! -name '.*' \) -type d | wc -l) == "1" ]]; then +# root="$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \;)" +# else +# root=$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \; | rofi -dmenu -p "Choose Database") +# fi +# root="${basedir}" +# fi +#} list_passwords() { passwords=( ~/.password-store/**/*.gpg ) @@ -58,12 +61,12 @@ xdotool_type() { } mainMenu () { - if [[ -z "$root" ]]; then - get_root - fi - if [[ -n "$2" ]]; then - root="$2" - fi +# if [[ -z "$root" ]]; then +# get_root +# fi +# if [[ -n "$2" ]]; then +# root="$2" +# fi if [[ $1 == "manage" ]]; then HELP="${edit}: Edit Entry | ${move}: Move Entry | ${delete}: Delete Entry | ${show}: Show Entry" selected_password="$(echo -e "0 Return to Main Menu\n---\n$(list_passwords 2>/dev/null)" | rofi -custom-kb-1 "${edit}" -custom-kb-2 "${move}" -custom-kb-3 "${delete}" -custom-kb-4 "${show}" -mesg "${HELP}" -dmenu -select "$entry" -p "rofi-pass > ")"