Additionally, this also makes the syntax of the `modify` command more flexible.
Before, the sub-command had to follow right after the `modify` command, now one can also write it with the id between command and sub-command:
```
$ timew modify @1 start 09:30
```
The `range` sub-command modifies both start and end time of the interval. It expects a range as parameter, e.g.
```
$ timew modify @3 range 08:15 - 13:37
```
Closes#627
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- Remove 'version' from docker-compose.yml
- Add Asciidoctor version to informative output
- Fix Asciidoctor install on OpenSUSE Tumbleweed
- Add Ubuntu 24.04 to test zoo
- Drop Ubuntu 18.04 from test zoo
- Add Fedora 40 to test zoo
- Add Fedora 41 to test zoo
- Drop Fedora 37 from test zoo
- Drop Fedora 38 from test zoo
Closes#648
Python upstream is trying to eliminate tz-naive date functions that
imply anything to do with a timezone, even UTC. They have deprecated
datetime.datetime.utcnow() in Python 3.12 and thus running tests emits
many warnings for us.
We switch to instantiate datetime objects taht are intended to reflect
UTC to have a timezone, or if we instantiate naive ones and then later
convert, we do the full conversion.
After the changes, the tests still work on Python 3.9, but now also on
Python 3.12 without warnings.
See PR description for #632 for more details.
Signed-off-by: Scott Mcdermott <scott@smemsh.net>
CentOS 8 reached end of life on 2021-12-31 (CentOS Stream8 on 2024-05-31)
CentOS 7 reaches end of life on 2024-06-30
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- Use UnitTest::ok in UnitTest::notok
- Extract report_* functions
- Extract common color function and constants
- Use templates to reduce code duplication
Currently, if an AtomicFile is opened on a symlink, the AtomicFile would
end up overwriting the link. This change makes AtomicFiles operate on
the targets of the links and not the links themselves.
```
$ test/AtomicFileTest
1..22
ok 1 - AtomicFileTest: Shall not exists before finalize
ok 2 - AtomicFileTest: Shall exists after finalize
ok 3 - AtomicFileTest: Shall have the correct data
ok 4 - AtomicFileTest: Neither shall exist before finalize
ok 5 - AtomicFileTest: Both shall exists after finalize
ok 6 - AtomicFileTest: First file shall contain the correct data
ok 7 - AtomicFileTest: Second file shall contain the correct data
ok 8 - AtomicFileTest: Appending does not update original before finalize
ok 9 - AtomicFileTest: Finalizing updates the appended data
ok 10 - AtomicFileTest: Read from Atomicfile
ok 11 - AtomicFileTest: Read from Atomicfile should read unfinalized data
ok 12 - AtomicFileTest: Two AtomicFiles should access same temp file (part 1)
ok 13 - AtomicFileTest: Two AtomicFiles should access same temp file (part 2)
ok 14 - AtomicFileTest: Two AtomicFiles should access same temp file (part 3)
ok 15 - AtomicFileTest: File not removed before finalize
ok 16 - AtomicFileTest: File is removed after finalize
ok 17 - AtomicFileTest: writes to symlinks end up in target
ok 18 - AtomicFileTest: shall maintain symlink
ok 19 - AtomicFileTest: AtomicFile::write_raw throws on error # skip
ok 20 - AtomicFileTest: AtomicFile::finalize_all() throws on error # skip
ok 21 - AtomicFileTest: AtomicFile::reset clears failure state # skip
ok 22 - AtomicFileTest: AtomicFile::append throws on error # skip
ok 23 - AtomicFileTest: AtomicFile::append did not partially fill the file. # skip
ok 24 - AtomicFileTest: AtomicFile::append failures prevent finalization # skip
```
Fixes#546
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
Before this change, when AtomicFileTest had errors, there was no match for details:
```
$ test/problems --details test/all.log
Traceback (most recent call last):
File "test/problems", line 145, in <module>
details_errors[filename] += " - " + detail.match(line).group(1) + "\n"
AttributeError: 'NoneType' object has no attribute 'group'
```
Now the details are pulled out properly:
```
$ test/problems --details test/all.log
Failed:
AtomicFile.t (2):
- AtomicFile::write_raw throws on error
- AtomicFile::finalize_all() throws on error
Unexpected successes:
Skipped:
Expected failures:
```
Why these tests are failing on this particular host is a matter for another time...
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
- Add CLI::getRange
- Make CLI::getTags return a set instead of a vector. This has the side effect that the tags are sorted now...
- Replace variable 'filter' by 'range' and 'tags'. Variable 'filter' was just a wrapper, better use the components directly
Use emplace_back instead of push_back
Use 'nullptr'
Use function 'empty ()' instead of 'size () == 0'
Mark single-argument constructors as 'explicit'
Call static function correctly
- Remove unused includes
- Use '<..>' style consistently
- Strip any paths from include
- Replace deprecated C++ headers
- Sort includes according to LLVM rules
https://llvm.org/docs/CodingStandards.html#include-style
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- 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>
- Replace tabs with spaces
- Use lowercase for CMake commands
- Unify alignment
- Remove superfluous empty line
- Add space after CMake command
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
We need to set the value of `MANPATH` to the local man pages when running helper function 'run_cmd_wait_nofail'.
Use the already set Timewarrior environment for this.
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
When calling summary command with :annotations hint, if the annotation
is longer than a certain length, it's going to be truncated. The issue
is that the length and truncation are done on a raw string without
considering UTF8 multibyte characters, so there are edge cases when an
annotation is truncated in the middle of a character creating an invalid
UTF8 string.
Added a test case for this scenario.
Signed-off-by: Maxim Beder <macsim.beder@gmail.com>
This patch checks if intervals are given on cli to 'timew export', and
if so will filter only those numbered IDs out from the db. This lets
the user that already knows the interval(s) they want to know about, to
ask for only those, without parsing the whole thing (similar to how we
can do this for taskwarrior IDs).
If both intervals and other filters -- time range or tags -- are given,
this is considered an error. There would seem to be little use to AND
or OR tags/ranges with IDs because anyone that knew IDs to request would
already know those IDs met their requirement.
Fixes#510
Code additions from @lauft PR notes (thanks!):
- factor out 'filtering' so we can do only one call to getTracked()
- simplify (tag || range) to .empty(), which already checks both
- error message phrasing
Signed-off-by: Scott Mcdermott <scott@smemsh.net>
- Replace unused return variables with '_'
- Use 'expected' and 'actual' for test values
- Add whitespace
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
The command timew help should redirect to the man tool.
Instead of testing that the header of the output matches some reg ex,
test that the outputs of `timew help` and `man` are equal
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>