Commit graph

1883 commits

Author SHA1 Message Date
Thomas Lauf
4f8a04e4ca Separate colum index from column offset
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 14:07:41 +01:00
Thomas Lauf
fabf70faa3 Add default value to Rules::getBoolean
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 14:07:41 +01:00
Thomas Lauf
5265b26e86 Add configurable default range for reports
Query rule 'reports.<name>.range' for the specific default range of the report.
Use rule 'reports.range' to configure an overall default range for all reports.
Make internal reports 'summary', 'month', 'week', 'day', and 'gaps' use this feature.

Closes #477

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 14:07:41 +01:00
Thomas Lauf
d056719a36 Enable to enter quoted hints as config value
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 14:01:20 +01:00
Thomas Lauf
29a00fbcd9 Code style: add curly braces
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 14:01:20 +01:00
Scott Mcdermott
bf26176243 Allow specification of intervals to the export command
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>
2022-12-28 22:13:35 +01:00
Stanisław Wysocki
04822aa195 Use XDG Base Directories compliant dirs on Unix for new installations
Signed-off-by: Stanisław Wysocki <garethel@protonmail.com>
2022-09-27 23:33:43 +02:00
Thomas Lauf
601050ae1f Quote filename
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-27 23:33:43 +02:00
Thomas Lauf
de17a067dc Use angle brackets in includes
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-27 23:33:43 +02:00
Thomas Lauf
23028bacb8 Remove stray entry
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-15 12:48:45 +02:00
Los Patchos
74a3d94f12 Return report exit code.
Continues to throw an exception and to return 255 if no output is produced.

Signed-off-by: Los Patchos <44246129+lospatchos@users.noreply.github.com>
2022-09-14 22:13:11 +02:00
Thomas Lauf
cbf87fc42e Clang-Tidy: Use emplace_back instead of push_back
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-14 22:12:44 +02:00
Shaun Ruffell
478e62db51 Update libshared to 47c3262fa97c4b69542040d39be6c516c38d0e57
Needed to allow database to be kept on some network filesystems
(GothenburgBitFactory/libshared#70).

fixes #465
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2022-08-19 12:45:17 +02:00
Thomas Lauf
69fc14af0b Make getAnnotation() const
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 21:24:57 +02:00
Thomas Lauf
79a02f73ca Make timew summary display open intervals with future start time
Closes #491

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 21:12:13 +02:00
Thomas Lauf
7c316b2ae1 Abort initialization if user does not confirm creation of new database
Fixes #489

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 07:46:23 +02:00
Thomas Lauf
8ba588dc24 Remove obsolete function subset (with Interval)
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-09 12:00:56 +01:00
Thomas Lauf
be5607bb8e Remove obsolete function getIntervalsByIds
- Was replaced by interval filter IntervalFilterAllWithIds in 9968b9e9

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-09 11:53:34 +01:00
Thomas Lauf
993ae85d5c Add check whether requested intervals have been found when searching by ID
- 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>
2022-01-09 11:43:56 +01:00
Thomas Lauf
6cf52faeb6 Update libshared to 072e0e0cb91c1e05e02db59ed83924b43e992938
With 179a6153, all 'end of' named dates point to the last second of the respective interval.
(see GothenburgBitFactory/taskwarrior#2519)
Redefine hint intervals in Timewarrior by 'start of' named dates, such that their ranges comprise the full interval as expected.

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-05 23:42:19 +01:00
Thomas Lauf
8ab44ba5e5 Skip empty intervals when flattening
Closes #403

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-03 23:15:16 +01:00
Thomas Lauf
4044635e08 Add complementary hint :holidays/no-holidays
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:48:03 +01:00
Thomas Lauf
1a6d5cacca Make summary output configurable via rules
- add config `reports.summary.ids` to toggle display of IDs
- add config `reports.summary.annotations` to toggle display of annotations
- add hints `:no-ids` and `:no-annotations` to override positive configs

Closes #474

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:48:03 +01:00
Thomas Lauf
b40f28ca4a Add braces to for and if statement
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:48:03 +01:00
Thomas Lauf
fe3c69ef20 Rename variable to show_annotations
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:48:03 +01:00
Thomas Lauf
4b483bab56 Rename variable to show_ids
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:48:03 +01:00
Thomas Lauf
17f9e8727c Add curly braces to if-statements
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:40:38 +01:00
Thomas Lauf
592f4b8b6e Apply 'one sentence, one line' to some comments
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:35:55 +01:00
Shaun Ruffell
6f0181d953 Do not leak filter in IntervalFilterFirstOf
This is a continuation of 285aa7171e, and should have been part
of that commit.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-12-06 08:30:38 +01:00
Shaun Ruffell
285aa7171e Do not leak IntervalFilters in IntervalFilterAndGroup
This eliminates the use of the naked "new" so that when the filters object is
destroyed, the filters are also freed.

This also eliminates a potential issue with binding an r-value reference to a
Range as a reference in IntervalFilterAllInRange.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-12-03 22:57:52 +01:00
Thomas Lauf
40d0c656e7 Replace getLatestInterval by new interval filtering
Replace in commands CmdAnnotate, CmdDefault, CmdContinue, CmdTag, and CmdUntag
Also in function domGet

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:16 +01:00
Thomas Lauf
9cd693d55d Use filter IntervalFilterFirstOf in CmdContinue
Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:16 +01:00
Thomas Lauf
244b351118 Add interval filter IntervalFilterFirstOf
A first-of interval filter is done when the first matching interval has been found.

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:16 +01:00
Thomas Lauf
9968b9e9d1 Replace function getIntervalsByIds by getTracked with new filtering
Replace getIntervalsByIds in commands CmdAnnotate, CmdContinue, CmdDelete,
CmdJoin, CmdLengthen, CmdModify, CmdMove, CmdResize, CmdShorten, CmdSplit,
CmdTag, and CmdUntag

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:15 +01:00
Thomas Lauf
5f96fd2878 Add interval filter IntervalFilterAndGroup
An and-group interval filter accepts all intervals which are accepted by all filters in its group.
It is done, if one of the filters in its group is done.

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:15 +01:00
Thomas Lauf
c546add03f Use new filtering in getTracked
Replace getTracked in commands CmdSummary, CmdChart, CmdExport, CmdFill,
CmdReport, CmdTags, and CmdContinue. Also in  functions domGet and autoFill

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:15 +01:00
Thomas Lauf
a7e2d8c08c Add interval filter IntervalFilterAllWithIds
An id-set interval filter accepts all intervals, which contain all ids of the given id set.
This filter is done when all ids have been found.

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:14 +01:00
Thomas Lauf
51bbb71708 Add interval filter IntervalFilterAllInRange
An all-in-range interval filter accepts all intervals which intersect with the given range.
This filter is done if it encounters an interval with an end datetime before its range's start datetime.

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:14 +01:00
Thomas Lauf
c789de7c4e Add interval filter IntervalFilterAllWithTags
An all-with-tags interval filter accepts all intervals which contain all tags of the given tag set.
This filter is never done, i.e. it will consume all intervals from the stream.

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:14 +01:00
Thomas Lauf
94f3077a4b Add abstract base class IntervalFilter
Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:13 +01:00
Lim Ding Wen
82b7e5537d SummaryColors: Fix formatting
Signed-off-by: Lim Ding Wen <limdingwen@gmail.com>
2021-11-12 22:15:05 +01:00
Lim Ding Wen
026ef7268f SummaryColors: Handle tags with no user-set colors
Signed-off-by: Lim Ding Wen <limdingwen@gmail.com>
2021-11-12 22:15:05 +01:00
Lim Ding Wen
aa08d0a3f2 SummaryColors: Add colors to summary
Signed-off-by: Lim Ding Wen <limdingwen@gmail.com>
2021-11-12 22:15:05 +01:00
Thomas Lauf
07d0dc0a98 Do not add empty exclusion ranges to list
Closes #466

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-11-12 21:59:25 +01:00
Thomas Lauf
d54df087cb Add braces to if- and for-statements
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-11-12 21:59:23 +01:00
Shaun Ruffell
7ffb2421a2 AtomicFile: Minor cleanups
1) Remove AtomicFile::impl::find and use std::find_if directly.

2) Remove static functions that take a string for path. Allow the compiler to
construct the Path object as necessary.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-07-13 20:31:55 +02:00
Shaun Ruffell
12696bf40c AtomicFile: Make the forward impl declaration private
This is more consistent with the intent of the code.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-07-13 20:31:55 +02:00
Thomas Lauf
75d3e879d6 Fix always true comparison
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 21:11:32 +02:00
Thomas Lauf
29d3043f29 Update copyright ranges
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 21:11:32 +02:00
Shaun Ruffell
3ea086dcff Allow getTracked to match intervals that intersect with filter
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>
2021-05-19 12:22:22 +02:00