add support for unlimited categories

This commit is contained in:
Dylan Araps 2019-02-24 23:38:55 +02:00
parent 6a972b9ca2
commit 0dabf88875
1 changed files with 6 additions and 1 deletions

7
pash
View File

@ -19,6 +19,10 @@ pw_add() {
[[ $password ]] ||
die "Failed to generate a password."
# Handle category in store name.
[[ $1 == */* ]] &&
mkdir -p "${1%/*}" || die "Couldn't create category '$1'."
gpg2 -co "$1.gpg" <<< "$password"
}
@ -36,7 +40,8 @@ pw_show() {
}
pw_list() {
pw_files=(*.gpg)
shopt -s globstar
pw_files=(**/*.gpg)
[[ ! -f ${pw_files[0]} ]] && {
printf '%s\n' "No stored passwords."