From 21ccf13f25fa3a2ad6774dd8fd1340ae468db27a Mon Sep 17 00:00:00 2001 From: atisne Date: Fri, 22 Dec 2017 17:45:54 +0100 Subject: [PATCH] Do not create an empty note --- tasknote | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasknote b/tasknote index a041861..e00b326 100755 --- a/tasknote +++ b/tasknote @@ -102,13 +102,15 @@ $SHELL -c "$EDITOR $file" # Create a note message representing the first line of # the edited note file. -if [ -f $file ]; then +if [ -s $file ]; then NOTEMSG="[tasknote] `head -1 $file`" # remove any previous annotation - we want only a single # tasknote annotation. Detection works through the # [tasknote] annotation prefix $SHELL -c "$TASKBIN $* denotate \"[tasknote]\"" $SHELL -c "$TASKBIN $* annotate '$NOTEMSG'" +else + [ -f $file ] && $SHELL -c "rm $file" fi exit 0