From 18aadb6673b81831d835dea8a49e67c44aceaa43 Mon Sep 17 00:00:00 2001 From: Daniel Mowitz Date: Mon, 16 Oct 2023 13:42:10 +0200 Subject: [PATCH] Update clean-tw.sh Automated confirmation process when deleting multiple tasks --- clean-tw.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/clean-tw.sh b/clean-tw.sh index 64bd7b8..3686b0b 100644 --- a/clean-tw.sh +++ b/clean-tw.sh @@ -5,18 +5,19 @@ function get_task_value { } ids=$(task limit:none recur | grep -E '^ ?[[:digit:]].*[[:alpha:]].*[[:digit:]]$' | sed -E 's/^ ?([[:digit:]]+) .*/\1/') + excluded_ids=$(for id in $ids - do - task_data="$(task $id)" - echo "$(get_task_value 'Parent task') $(get_task_value 'Description' | sed 's/ /_/g') $(get_task_value 'Due') $id" - done | sort | rev | uniq -f3 | rev | sed -E 's/.* ([[:digit:]]+)$/\1/') + do + task_data="$(task $id)" + echo "$(get_task_value 'Parent task') $(get_task_value 'Description' | sed 's/ /_/g') $(get_task_value 'Due') $id" + done | sort | rev | uniq -f3 | rev | sed -E 's/.* ([[:digit:]]+)$/\1/') del_ids=$(for id in $excluded_ids $ids - do - echo $id - done | sort | uniq -u) + do + echo $id + done | sort | uniq -u) if [ ! -z "$del_ids" -a "$del_ids" != " " ] then - task $del_ids del + { echo 'all'; yes n; } | task $del_ids del fi