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>
The error message may be different depending on the man tool used.
Therefore, instead of hard-coding it into the test, ensure it is the same as produced by the man command
Closes#512
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
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>
- Restores behaviour which got lost when switching to the new interval filtering in 9968b9e9
- Add test for each command
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- Fix `--fail-at-end` option
- Collect errors and print report at end
- Make variable `tests` an array, add safeguards
- Combine cases
- Make variables `dates`, `hours`, `minutes` an array, add `pad_with_zero` function
- Execute test with specific 'runtime', so it picks up fake time
- Python scripts are then executed as `faketime <date> python3 <test>`
- Shell scripts as `faketime <date> bash <test>`
- Everything else as `faketime <date> <test>`
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
I left some unused varaibles in a new test functions after copy-paste.
This addresses @laufts comments on #423.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
It is not sufficient to stop looking for matching intervals if the
interval start time is before the filter. We really want to make sure
that we pick up any intervals that intersect with the filter.
Fixes bug introduced in (a98bd14 "Simplify getIntervalsById and
getTracked") as part of #423.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This also installs asciidoctor 2.0.15 explicitly so that if the latest
is changed upstream the update-alternatives line will not break.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This fixes an error where the latest interval, a non-synthetic interval,
is added to the synthetic array (and marked synthetic) if flatten() is
otherwise not able to convert it to a group of synthetic intervals.
When modify was attempting to edit this interval, it would fail since
synthetic intervals should not be written to the database unless the
database is being flattened and timewarrior believed the interval to be
modified was synthetic.
Closes#422
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
The JSON library in libshared has functions to esacpe JSON's special
characters, but they are not used by default.
Closes#416
Related to #261
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
The bitwise or, `|` had higher precendence than the `>` test. Fixes the
following error:
not ok 4 - summary.t: Summary should work with :all hint
# FAIL: AssertionError on file test/summary.t line 213 in test_with_all_hint: 'self.assertIn("""':
# '
# Wk Date Day ID Tags Start End Time Total
# -- ---------- --- -- ---- -------- -------- ------- -------
# W13 2021-04-04 Sun @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
# W14 2021-04-05 Mon @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
# W14 2021-04-06 Tue @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
#
# 3:00:00
# ' not found in '
# Wk Date Day ID Tags Start End Time Total
# --- ---------- --- -- ---- -------- -------- ------- -------
# W13 2021-04-04 Sun @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
# W14 2021-04-05 Mon @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
# W14 2021-04-06 Tue @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
#
# 3:00:00
#
# '
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
The help.t test wants to verify that some of the man pages exist.
Therefore we need to make sure the documentation is built, otherwise:
$ git clean -ffdx .
$ cmake -DCMAKE_BUILD_TYPE=Debug .
$ make test
Will fail some of the help.t tests.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This replaces the generation of man pages on project setup
by a on-demand generation via asciidoctor.
An exception are the man pages for the commands `day`, `month`, and `week`
which are simply redirects to the man page `timew-chart.1`. Those are now
static files in the Timewarrior repository.
A CMake find module to detect asciidoctor was added.
If asciidoctor is found, the targets `doc`, `man1`, and `man7` are created.
Those targets are also added to the default build target.
If asciidoctor is not available, the target `doc` is available, but it only
emits a message to install asciidoctor first.
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
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>
Python added Thread.is_alive() in 2.6 and removed Thread.isAlive() in
3.9.
This change is needed to run the tests with Python 3.9.
https://bugs.python.org/issue37804
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>