- `task delete` does add 'end' to modified JSON but not remove key 'start'
- Stop time tracking when task is deleted
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
When input data from taskwarrior (e.g. via bugwarrior) contains UTF-8-illegal characters, `on-modify.timewarrior` would fail:
```
Traceback (most recent call last):
File "$HOME/.task/hooks/on-modify.timewarrior", line 42, in <module>
old = json.loads(sys.stdin.readline())
File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 1042: invalid continuation byte
```
This is fixed by manually decoding from stdin's underlying binary I/O object and replacing encoding errors with the Unicode replacement character [1].
[1]: https://docs.python.org/3/library/codecs.html#error-handlers
If the description contained multiple lines, it would be formatted as a
bytes object, including Python's `b""` marker for byte literals and any
newlines. This would then be passed literally to `timew`, which would
then choke on it, because it would record the newlines in its database.
This patch simply gets rid of the string join/split operations and the
encoding, which solves the issue.
Since we pass arrays instead of strings to `subprocess.call`, we are not
subject to command injection security vulnerabilities.
Fixes: 0b6dbf7e12d30fc791a524501e3483989a092a8c
Fixes the following error with Python 3.6.8:
```
File "$HOME/.task/hooks/on-modify.timewarrior", line 33
from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
```
The taskwarrior extension script `on-modify.timewarrior` did not forward
modifications for description/tag/project to `timew`.
This resulted in non-existent tasks (with old tag etc) contiued to be
tracked and not updated
[Closes#105](https://github.com/GothenburgBitFactory/timewarrior/issues/105)
- This first draft hook script uses the task UUID, description, project and tags
as Timewarrior tags, and responds to 'task <id> start' and 'task <id> stop'
commands, as well as other changes that have the same effect.