Commit graph

30 commits

Author SHA1 Message Date
Thomas Lauf
f2e11a0d2d Update task-timewarrior-hook script to 87a3426d8153f92aaee2edf36b2de62e48c4de0e 2023-12-22 23:13:13 +01:00
Thomas Lauf
6d79ea4a6d Update copyright statements
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-09-18 12:33:17 +02:00
Thomas Lauf
edfabcc1e5 Update on-modify.timewarrior to 360fc2292a5eab46cd5c9bdd4cc791b6f9ea5e9a
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-03-24 20:46:37 +01:00
Tomas Babej
e5870380a4
doc: Update copyright to 2021 2021-01-02 02:52:39 -05:00
Thomas Lauf
ad58309159 Update Copyright
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-04-19 12:41:23 +02:00
Thomas Lauf
5ab9b86e56 Set python version explicitly to python3
- Closes #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 21:32:39 +01:00
Thomas Lauf
2a3caad1cd Process task annotate
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-08-22 22:34:22 +02:00
Thomas Lauf
fc383b73de Small refactoring
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-08-22 22:34:22 +02:00
Thomas Lauf
b19b5eef10 Fix for task delete
- `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>
2019-08-22 22:34:22 +02:00
Thomas Lauf
a0a5e0ddac Make hook run in both python 2 and 3
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-08-22 22:34:22 +02:00
Dennis Schridde
7fe4d2ff39 on-modify.timewarrior: Deal with non-UTF-8 characters in input data from taskwarrior
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
2019-08-22 21:51:03 +02:00
Dennis Schridde
61a4749d75 Fix on-modify.timewarrior hook for tasks with multi line description
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: 0b6dbf7e12
2019-08-22 21:39:11 +02:00
Dennis Schridde
5b53f5c3ba on-modify.timewarrior: Fix "from __future__ imports must occur at the beginning of the file"
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
```
2019-08-22 21:25:41 +02:00
Thomas Lauf
bf2e36fb57 Make ext/on-modify.timewarrior executable so tests will work 2019-08-17 18:16:42 +02:00
quazgar
1fd6c86641 MAINT: Removing comment. 2019-06-04 16:41:32 +02:00
quazgar
01674283c6 MAINT: on-modify.timewarrior imports from future
This should fix #216.

Untested commit.
2019-06-04 16:41:32 +02:00
Harish Ved
ea671d28bd ReviewFixes: Reset tags instead of stop/start task; formatting changes 2018-05-15 18:21:36 +02:00
Harish Ved
d07cc99729 Handling modifications to description/tag/project for task
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)
2018-05-15 18:21:36 +02:00
Thomas Lauf
0b6dbf7e12 TI-94 #98 Fix Command Injection Security Vulnerability in on-modify.timewarrior
- Thanks to Aaron Fields
- Add unit test?
- What about missing ```if '.' in project:```?
2018-03-20 22:56:40 +01:00
Simon Ruderich
2271bd9eea Use https:// link for opensource.org 2018-03-16 23:11:08 +01:00
Paul Beckingham
e4daeb2078 TI-32: taskwarrior hook script doesn't stop recording waiting task
- Thanks to Yury Videneev.
2017-03-19 11:13:32 -04:00
Thomas Lauf
310f48973e extensions: Make extensions conform with PEP8 2017-03-01 21:20:35 +01:00
Paul Beckingham
c3e2759028 TI-48: Timewarrior hook is not Python3 compatible
- Thanks to Josh Proehl, Armado Martinez.
2017-02-25 14:17:25 -05:00
Paul Beckingham
db53745181 TI-51: in the taskwarrior hook, deleting a task doesn't stop the watch
- Thanks to Mattia Rizzolo.
2016-11-05 11:57:15 -04:00
Paul Beckingham
6557814909 Ext: Taskwarrior project handling
- Taskwarrior projects are now used as-is as tags, and also split on the '.' to
  represent project hierarchy as separate tags.
- Thanks to Josh Proehl.
2016-10-04 00:27:20 -04:00
Paul Beckingham
123655079c Ext: Fixed utf8 encoding in Taskwarrior integration hook
- Thanks to Martin Boeker.
2016-07-06 23:23:41 -04:00
Paul Beckingham
b62a977bd5 TI-16: Should handle case where taskwarrior hook is used before timew
- Thanks to Aaron Curtis.
2016-06-28 18:15:42 -04:00
Paul Beckingham
aa00f436a1 Ext: Removed UUID from hook script 2016-06-05 14:29:18 -04:00
Paul Beckingham
0d3d01de59 Extensions: Added Taskwarrior integration hook
- 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.
2016-04-03 17:30:45 -04:00
Paul Beckingham
ff8e3ef68d Ext: Added initial extensions and README 2016-03-26 13:02:55 -04:00