summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-22 17:24:30 +0200
committerPaul Buetow <paul@buetow.org>2026-02-22 17:24:30 +0200
commitd3c337838f99a8d66db7930e2f1ae1689496495e (patch)
tree5fc36df7d8924465490e4d4edfdd05d6dbc59745
parent120764ad8f11d354725fff6583ee66453167ec51 (diff)
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 <amp@ampcode.com>
-rw-r--r--fish/conf.d/taskwarrior.fish18
1 files 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