commit e7c383e34da9e1a28d576607f9bb027b4524c531 parent 8346d757f6b9ddc63163dd7d4a6160b87d3d505f Author: Klemens Nanni <kl3@posteo.org> Date: Mon, 29 Feb 2016 21:22:30 +0100 Add remove function Diffstat:
M | tpm | | | 10 | +++++++++- |
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tpm b/tpm @@ -85,12 +85,20 @@ insert() { | gpg2 ${GPG_OPTS} --encrypt --output "${STORE_DIR}"/"${1}".gpg } +remove() { + [ -z "${1}" ] && abort "USAGE: tpm remove ENTRY" + + [ -e "${STORE_DIR}"/"${1}".gpg ] || abort "The requested entry doesn't exist." + + rm -i "${STORE_DIR}"/"${1}".gpg && echo "${1} has been removed." +} + ### Parse input ### [ $# -gt 2 ] && abort "tpm doesn't accept more than two arguments." case "${1}" in - 'show'|'insert'|'list') + 'show'|'insert'|'list'|'remove') ${1} "${2}" ;; 'help')