spm

Personal fork of spm (simple password manager)
git clone git@getsh.org:spm.git
Log | Files | Refs | README | LICENSE

commit cebb086a9d4efbf19da8a00cc178e8f5af7abfc1
parent e7c383e34da9e1a28d576607f9bb027b4524c531
Author: Klemens Nanni <kl3@posteo.org>
Date:   Mon, 29 Feb 2016 21:24:43 +0100

Sort functions alphabetically

Diffstat:
Mtpm | 38+++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/tpm b/tpm @@ -48,26 +48,8 @@ usage() { echo "USAGE: tpm show|insert|list|help [ENTRY|GROUP]" } -list() { - [ -d "${STORE_DIR}" ] || mkdir -p "${STORE_DIR}" - - [ -n "${1}" ] && [ ! -d "${STORE_DIR}/${1}" ] \ - && abort "The specified group doesn't exist. See 'tpm list'." - - tree --noreport -- "${STORE_DIR}/${1}" - echo -} - ### Commands ### -show() { - [ -z "${1}" ] && abort "USAGE: tpm show ENTRY" - - [ -e "${STORE_DIR}"/"${1}".gpg ] || abort "The requested entry doesn't exist." - - gpg2 ${GPG_OPTS} --decrypt "${STORE_DIR}"/"${1}".gpg -} - insert() { [ -z "${1}" ] && abort "USAGE: tpm insert ENTRY" @@ -85,6 +67,16 @@ insert() { | gpg2 ${GPG_OPTS} --encrypt --output "${STORE_DIR}"/"${1}".gpg } +list() { + [ -d "${STORE_DIR}" ] || mkdir -p "${STORE_DIR}" + + [ -n "${1}" ] && [ ! -d "${STORE_DIR}/${1}" ] \ + && abort "The specified group doesn't exist. See 'tpm list'." + + tree --noreport -- "${STORE_DIR}/${1}" + echo +} + remove() { [ -z "${1}" ] && abort "USAGE: tpm remove ENTRY" @@ -93,12 +85,20 @@ remove() { rm -i "${STORE_DIR}"/"${1}".gpg && echo "${1} has been removed." } +show() { + [ -z "${1}" ] && abort "USAGE: tpm show ENTRY" + + [ -e "${STORE_DIR}"/"${1}".gpg ] || abort "The requested entry doesn't exist." + + gpg2 ${GPG_OPTS} --decrypt "${STORE_DIR}"/"${1}".gpg +} + ### Parse input ### [ $# -gt 2 ] && abort "tpm doesn't accept more than two arguments." case "${1}" in - 'show'|'insert'|'list'|'remove') + 'insert'|'list'|'remove'|'show') ${1} "${2}" ;; 'help')