From 60cbfd56139d9d944a8da9640680c22ae9c4ed26 Mon Sep 17 00:00:00 2001 From: atisne Date: Fri, 22 Dec 2017 16:17:45 +0100 Subject: [PATCH] Add the ability to delete a note --- tasknote | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tasknote b/tasknote index a041861..23858f5 100755 --- a/tasknote +++ b/tasknote @@ -68,10 +68,11 @@ NOTEMSG="See Notes File" # Display usage if task number not supplied on cli if [ $# -lt 1 -o $# -gt 2 ]; then - echo "Usage:" - echo " New/Edit note: $0 " - echo " View note: $0 v" - exit 1 + echo "Usage:" + echo " New/Edit note: $0 " + echo " View note: $0 v" + echo " Delete note: $0 d" + exit 1 fi #find UUID from given task @@ -87,14 +88,23 @@ if [ -f $file ]; then fileexists=1 fi -# Display note if requested and exit +# Display/remove note if requested and exit if [ $# -gt 1 ]; then - if [ $fileexists = 1 ]; then - $SHELL -c "$VIEWER $file" - else - echo "File not found" - fi - exit 1 + if [ $fileexists = 1 ]; then + action=$2 + case $action in + v) + $SHELL -c "$VIEWER $file" + ;; + d) + $SHELL -c "rm $file" + $SHELL -c "$TASKBIN $1 denotate \"[tasknote]\"" + ;; + esac + else + echo "File not found" + fi + exit 1 fi #create/edit $file with editor