Commit graph

63 commits

Author SHA1 Message Date
Thomas Lauf
e735c3a403 Set CMake minimum version to 3.10 2025-02-05 22:42:14 +01:00
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
3008e458e9 Update project to C++17
- Bump CMake to minimum version 3.8
- Set C++ standard to 17
- Remove CMAKE_LEGACY_CYGWIN_WIN32 compatibility mode
- Remove C++11 stuff
- Update documentation

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 08:41:07 +02:00
Ankur Sinha (Ankur Sinha Gmail)
834af86d5b fix(totals.py): correct handling of report end when it is available
Signed-off-by: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
2023-05-26 08:51:13 +02:00
Ankur Sinha (Ankur Sinha Gmail)
99d18f42bb fix(totals.py): return all info when no arguments are provided
Signed-off-by: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
2023-05-26 08:51:13 +02:00
Ankur Sinha (Ankur Sinha Gmail)
75d037d353 fix(totals.py): end report at current time if a task is being tracked
Fixes #540

Signed-off-by: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
2023-05-26 08:51:13 +02:00
Thomas Lauf
14bed139f6 Update copyrights
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-04 22:44:44 +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
Thomas Lauf
123632a806 Add link to dedicated repository for on-modify.timewarrior hook
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-03-19 22:56:51 +01:00
Thomas Lauf
c80442c878 Make report 'totals.py' display data when no time range specified
Use interval array to determine whether there is data to display
Move interval truncation outside the loop, combine/rework 'no data' messages

Close #450

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-01 23:04:46 +01:00
Thomas Lauf
49c33591b8 Make report 'totals.py' truncate intervals to search range
Closes #505

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-01 18:32:56 +01:00
Thomas Lauf
65ef38658b Increase minimal CMake version
Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
According to our test images all supported distributions have CMake > 3

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-02-12 10:50:39 +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
3f3c4c3108 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 18:52:19 +01:00
Thomas Lauf
dc77a8c457 Use new style formatting
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 18:39:18 +01:00
Thomas Lauf
d746b422bf Accommodate PEP8
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 18:31:20 +01:00
Thomas Lauf
6c601cfeb8 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 18:30:28 +01:00
Thomas Lauf
4f657e57d9 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 15:30:17 +01:00
Michael Eischer
8053ccf68e Fix calculation of totals longer than a day
datetime.timedelta stores days, seconds and microseconds. Therefore the
seconds attribute only stores timedeltas of less than 24 hours. Use
total_seconds() instead which properly accounts for the days part.
2019-10-18 10:56:50 +02: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
Thomas Lauf
37a3aa0ccf Rework markdown
- One line per sentence
- Use '#' instead of underline to mark headings
- Consistent indentation
2018-12-21 12:48:22 +01:00
Thomas Lauf
9598f01fcf Remove accidentially added files from repository 2018-12-06 13:36:17 +01:00
Thomas Lauf
c598f2bd66 Add lower bounds check for DOM tag reference
- Closes #189
2018-11-25 12:24:30 +01: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
b5acfed98f Refactor totals.py
- add main
- move algorithm to function
- use __future__ module
- introduce new style formatting
- restructure test_totals.t accordingly
- add test for empty range
- add tests for colored output
2018-05-10 19:22:34 +02:00
Thomas Lauf
147865b50b Fix time output in totals.py
- Convert UTC time to local time in output
- Change single quote to double quote
- Use new style python formatting
- Make tests use current time
- Fix test for open interval
2018-05-09 18:25:16 +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
Thomas Lauf
f8ee042bf0 Small refactoring 2018-02-18 23:09:37 +01:00
Davis
68fdcc0b20
Fixed error from totals.py while timer is active
I got the following error when I tried to run totals.py while a task was not finished:

    Traceback (most recent call last):
      File "/home/davis/.timewarrior/extensions/totals.py", line 101, in <module>
        end = datetime.datetime.strptime(configuration['temp.report.end'], DATEFORMAT)
    KeyError: 'temp.report.end'

This change fixed that for me.
2018-02-14 00:49:53 -05:00
Paul Beckingham
d55ca5b474 Ext: Updated totals.py for both Python 2 and 3 2017-04-14 23:59:24 -04: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
e51292e1ec Ext: Added totals.py to README 2017-02-25 14:31:57 -05: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
Thomas Lauf
8ad54f9bfd TI-40: totals.py extension script fails with an error
- Improve totals.py extension script:
- Fix display issue if tags are shorter than string 'Totals'
- Fix issue when totals.py is called on empty database
- Add tests: test_totals.t
2017-02-14 23:33:02 +01: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