diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-22 17:24:30 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-22 17:24:30 +0200 |
| commit | d3c337838f99a8d66db7930e2f1ae1689496495e (patch) | |
| tree | 5fc36df7d8924465490e4d4edfdd05d6dbc59745 | |
| parent | 120764ad8f11d354725fff6583ee66453167ec51 (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.fish | 18 |
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 |
