Open xeruf opened 4 years ago
Interaction between Taskwarrior and Timewarrior is managed by the on-modify.timewarrior
hook. Currently the hook script does not extract the start time from the supplied JSON.
To better analyse your issue you could provide a minimal reproducing example JSON, like
# create test environment
export TASKRC=/tmp/taskwarrior/taskrc
export TASKDATA=/tmp/taskwarrior/task
mkdir -p ${TASKDATA}
rm -rf ${TASKDATA:?}/*
:> ${TASKRC}
mkdir -p ${TASKDATA}/hooks
cp path/to/on-modify.dump ${TASKDATA}/hooks # set path to dumper script here!
rm -rf ${TASKDATA:?}/*.data # clean previous runs
# enter the necessary commands to reproduce the issue here, e.g.
task start 1 21:00
# The dumped JSON data is now available at /tmp/on-modify.dump...
The dumper-script:
#!/bin/bash
# The on-modify event is triggered separately for each task modified.
# Input:
# - line of JSON for the original task
# - line of JSON for the modified task, the diff being the modification
read original_task
read modified_task
echo "${original_task}" > /tmp/on-modify.dump
echo "${modified_task}" >> /tmp/on-modify.dump
# Output:
# - JSON, modified or unmodified.
# - Optional feedback/error.
echo "${modified_task}"
echo 'on-modify'
# Status:
# - 0: JSON accepted, non-JSON is feedback.
# - non-0: JSON ignored, non-JSON is error.
exit 0
oh, I just realised that the syntax above actually creates an annotation instead of marking the start time.
task 1 modify start:2020-05-06T09:00
seems to be the only working way, but that isn't recognized by the hook either.
I couldn't really find any docs on task-start, what it exactly does, which options it supports, whether you can specify a time. I guess I'm gonna ask in taskwarrior as well.
It also obviously ignores changes of the start time - the hook doesn't care at all if I change the start time of an active task.
As mentioned above: 😉
Currently the hook script does not extract the start time from the supplied JSON.
Yeah I know, just wanted to record that separately in case that changes implementation details :)
Got it fixed, will open a PR soon :)
Okay, there is still one issue: In Taskwarrior, multiple tasks can be started at the same time - thus a task that is not actually tracked in timewarrior can have its start time modified, which currently totally messes up things. I think we need to check for an exact match and otherwise create a new timetracking - this is tougher than I thought ^^
When starting a task with something such as
task start 1 21:00
, taskwarrior correctly marks the task as started at that time in the past, but timewarrior assumes it to have been started just now.