aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-07-14 21:43:20 +0200
committerRasmus Steinke <rasi@xssn.at>2015-07-14 21:43:20 +0200
commit62981f255a8f3bc32f36ac4f108e3aa1d1ae8ce8 (patch)
treec56979f0026f08e500be53d5ec7dd8bfd1cf1cce
parent81e2bd89d000d272e95614237cd4fb0f926faf14 (diff)
downloadrofi-pass-62981f255a8f3bc32f36ac4f108e3aa1d1ae8ce8.tar.gz
fix adding of new entries
-rwxr-xr-xrofi-pass30
1 files changed, 22 insertions, 8 deletions
diff --git a/rofi-pass b/rofi-pass
index 87376a0..3be06b0 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -25,15 +25,17 @@ if [[ -z $BROWSER ]]; then
fi
if [[ -n "$2" ]]; then
- root="${basedir}/${2}"
- clear
- echo "$root"
+ root="${2}"
else
- root="${basedir}"
+ :
fi
list_passwords() {
- passwords=( "${root}"/**/*.gpg )
+ if [[ -n "$root" ]]; then
+ passwords=( "${basedir}/${root}"/**/*.gpg )
+ else
+ passwords=( "${basedir}"/**/*.gpg )
+ fi
for password in "${passwords[@]}"; do
filename="${password#$basedir}"
@@ -204,12 +206,24 @@ insertPass () {
elif [[ $menu == "" ]]; then exit
elif [[ $menu == "* Accept Values and Add Password Entry" ]]; then
notab=$(echo -e "Yes\nNo" | rofi -dmenu -p "Page uses Auto Tab? > ")
- cd "$HOME"/.password-store/"${root}"
+ if [[ -n "$root" ]]; then
+ cd "${basedir}/${root}"
+ else
+ cd "${basedir}"
+ fi
group=$(find -type d -not -iwholename '*.git*' -printf '%d\t%P\n' | sort -r -nk1 | cut -f2- | rofi -dmenu -p "Choose Group > ")
if [[ "$notab" == "No" ]]; then
- pass insert -m -f "${root}"/"$group"/"$name" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}")
+ if [[ -n "$root" ]]; then
+ pass insert -m -f "${root}/${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}")
+ else
+ pass insert -m -f "${group}/${name}" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}")
+ fi
elif [[ "$notab" == "Yes" ]]; then
- pass insert -m -f "${root}"/"$group"/"$name" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}\nNOTAB")
+ if [[ -n "$root" ]]; then
+ pass insert -m -f "${root}"/"$group"/"$name" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}\nNOTAB")
+ else
+ pass insert -m -f "$group"/"$name" < <(echo -e "${pass}\nUserName: ${user}\n---\nURL: ${domain}\nNOTAB")
+ fi
fi
elif [[ $menu == "1 Name"* ]]; then
name=$(echo "" | rofi -dmenu -p "Enter Name > ")