spm

simple password manager
git clone anongit@rnpnr.xyz:spm.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 7af28bc823d2a99e218dfd7f7af50309ecd140b5
Parent: a06079f0c35721a8552892ac20d9fc79f4561b9b
Author: Klemens Nanni
Date:   Mon, 29 Feb 2016 08:29:06 +0100

No need for entry_name and entry_path

Diffstat:
Mtpm | 24+++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/tpm b/tpm @@ -71,34 +71,28 @@ list() { ## show() { - entry_name="${1}" - entry_path="${STORE_DIR}/${entry_name}.gpg" + [ -z "${1}" ] && abort "USAGE: tpm show ENTRY" - [ -z "${entry_name}" ] && abort "USAGE: tpm show ENTRY" + [ -e "${STORE_DIR}"/"${1}".gpg ] || abort "The requested entry doesn't exist." - [ -e "${entry_path}" ] || abort "The requested entry doesn't exist." - - gpg2 ${GPG_OPTS} --decrypt "${entry_path}" + gpg2 ${GPG_OPTS} --decrypt "${STORE_DIR}"/"${1}".gpg } insert() { - entry_name="${1}" - entry_path="${STORE_DIR}/${entry_name}.gpg" - - [ -z "${entry_name}" ] && abort "USAGE: tpm insert ENTRY" + [ -z "${1}" ] && abort "USAGE: tpm insert ENTRY" - [ -e "${entry_path}" ] \ + [ -e "${STORE_DIR}"/"${1}".gpg ] \ && abort "This entry already exists, please remove it first." password="" - readpw "Password for '${entry_name}': " password + readpw "Password for '${1}': " password [ -t 0 ] && printf "\n" [ -z "${password}" ] && abort "You didn't specify a password." - mkdir -p "$(dirname "${entry_path}")" - printf '%s\n' "${password}" | gpg2 ${GPG_OPTS} \ - --encrypt --output "${entry_path}" + mkdir -p "$(dirname "${STORE_DIR}"/"${1}".gpg)" + printf '%s\n' "${password}" \ + | gpg2 ${GPG_OPTS} --encrypt --output "${STORE_DIR}"/"${1}".gpg } ##