From d3c337838f99a8d66db7930e2f1ae1689496495e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 22 Feb 2026 17:24:30 +0200 Subject: fix: export completed +work tasks to worktime repo Previously only status:pending tasks were exported, so any +work task completed before supersync ran was silently skipped and never reached the worktime git repo. Completed +work +random tasks were then permanently lost by taskwarrior::db::prune. Amp-Thread-ID: https://ampcode.com/threads/T-019c85e5-1074-70cc-a6a3-9f1b68abee3d Co-authored-by: Amp --- fish/conf.d/taskwarrior.fish | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fish/conf.d/taskwarrior.fish b/fish/conf.d/taskwarrior.fish index 7ec437b..e822d60 100644 --- a/fish/conf.d/taskwarrior.fish +++ b/fish/conf.d/taskwarrior.fish @@ -99,15 +99,19 @@ end function taskwarrior::export _taskwarrior::set_import_export_tags - set -l count (task +$TASK_EXPORT_TAG status:pending count) + set -l ts (date +%s) - if test $count -eq 0 - return - end + for task_status in pending completed + set -l count (task +$TASK_EXPORT_TAG status:$task_status count) + + if test $count -eq 0 + continue + end - echo "Exporting $count tasks to $TASK_EXPORT_TAG" - task +$TASK_EXPORT_TAG status:pending export >"$WORKTIME_DIR/tw-$TASK_EXPORT_TAG-export-$(date +%s).json" - yes | task +$TASK_EXPORT_TAG status:pending delete + echo "Exporting $count $task_status tasks to $TASK_EXPORT_TAG" + task +$TASK_EXPORT_TAG status:$task_status export >"$WORKTIME_DIR/tw-$TASK_EXPORT_TAG-export-$ts-$task_status.json" + yes | task +$TASK_EXPORT_TAG status:$task_status delete + end end function taskwarrior::import -- cgit v1.2.3