From 544c006f88522ed77d27c1612db8fd5eb3db1737 Mon Sep 17 00:00:00 2001 From: chrysle Date: Sun, 18 Dec 2022 15:11:00 +0100 Subject: [PATCH] Added warning message for todo.sh archive --- todo.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/todo.sh b/todo.sh index fb8d4bce..36904556 100755 --- a/todo.sh +++ b/todo.sh @@ -1142,11 +1142,16 @@ case $action in "archive" ) # defragment blank lines sed -i.bak -e '/./!d' "$TODO_FILE" - [ "$TODOTXT_VERBOSE" -gt 0 ] && grep "^x " "$TODO_FILE" - grep "^x " "$TODO_FILE" >> "$DONE_FILE" - sed -i.bak '/^x /d' "$TODO_FILE" - if [ "$TODOTXT_VERBOSE" -gt 0 ]; then - echo "TODO: $TODO_FILE archived." + if [ "$TODOTXT_VERBOSE" -gt 0 ] && grep "^x " "$TODO_FILE"; then + grep "^x " "$TODO_FILE" >> "$DONE_FILE" + sed -i.bak '/^x /d' "$TODO_FILE" + if [ "$TODOTXT_VERBOSE" -gt 0 ]; then + echo "TODO: $TODO_FILE archived." + fi + else + if [ "$TODOTXT_VERBOSE" -gt 0 ]; then + echo "TODO: $TODO_FILE does not contain any done tasks." + fi fi ;;