mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Make display of tags column configurable
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
6fdda2bacd
commit
6f141f6301
3 changed files with 24 additions and 10 deletions
|
@ -37,6 +37,11 @@ Determines whether the id column is shown in the summary.
|
||||||
Can be overridden by the ':ids' and ':no-ids' hint, respectively.
|
Can be overridden by the ':ids' and ':no-ids' hint, respectively.
|
||||||
Default value is 'no'
|
Default value is 'no'
|
||||||
|
|
||||||
|
**reports.summary.tags**::
|
||||||
|
Determines whether the tags column is shown in the summary.
|
||||||
|
Can be overridden by the ':tags' and ':no-tags' hint, respectively.
|
||||||
|
Default value is 'yes'.
|
||||||
|
|
||||||
**reports.summary.range**::
|
**reports.summary.range**::
|
||||||
Set the date range for the summary report.
|
Set the date range for the summary report.
|
||||||
The value has to be a range hint, see timew-hints(7).
|
The value has to be a range hint, see timew-hints(7).
|
||||||
|
|
|
@ -92,17 +92,19 @@ int CmdSummary (
|
||||||
Color colorID (rules.getBoolean ("color") ? rules.get ("theme.colors.ids") : "");
|
Color colorID (rules.getBoolean ("color") ? rules.get ("theme.colors.ids") : "");
|
||||||
|
|
||||||
const auto show_ids = cli.getComplementaryHint ("ids", rules.getBoolean ("reports.summary.ids"));
|
const auto show_ids = cli.getComplementaryHint ("ids", rules.getBoolean ("reports.summary.ids"));
|
||||||
|
const auto show_tags = cli.getComplementaryHint ("tags", rules.getBoolean ("reports.summary.tags", true));
|
||||||
const auto show_annotations = cli.getComplementaryHint ("annotations", rules.getBoolean ("reports.summary.annotations"));
|
const auto show_annotations = cli.getComplementaryHint ("annotations", rules.getBoolean ("reports.summary.annotations"));
|
||||||
|
|
||||||
const auto tags_col_offset = show_ids ? 1 : 0;
|
const auto tags_col_offset = show_ids ? 1 : 0;
|
||||||
const auto start_col_offset = tags_col_offset + (show_annotations ? 1 : 0);
|
const auto annotation_col_offset = tags_col_offset + (show_tags ? 1 : 0);
|
||||||
|
const auto start_col_offset = annotation_col_offset + (show_annotations ? 1 : 0);
|
||||||
|
|
||||||
const auto tags_col_index = 3 + tags_col_offset;
|
const auto tags_col_index = 3 + tags_col_offset;
|
||||||
const auto annotation_col_index = 4 + tags_col_offset;
|
const auto annotation_col_index = 3 + annotation_col_offset;
|
||||||
const auto start_col_index = 4 + start_col_offset;
|
const auto start_col_index = 3 + start_col_offset;
|
||||||
const auto end_col_index = 5 + start_col_offset;
|
const auto end_col_index = 4 + start_col_offset;
|
||||||
const auto duration_col_index = 6 + start_col_offset;
|
const auto duration_col_index = 5 + start_col_offset;
|
||||||
const auto total_col_index = 7 + start_col_offset;
|
const auto total_col_index = 6 + start_col_offset;
|
||||||
|
|
||||||
Table table;
|
Table table;
|
||||||
table.width (1024);
|
table.width (1024);
|
||||||
|
@ -116,7 +118,10 @@ int CmdSummary (
|
||||||
table.add ("ID");
|
table.add ("ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
table.add ("Tags");
|
if (show_tags)
|
||||||
|
{
|
||||||
|
table.add ("Tags");
|
||||||
|
}
|
||||||
|
|
||||||
if (show_annotations)
|
if (show_annotations)
|
||||||
{
|
{
|
||||||
|
@ -178,14 +183,16 @@ int CmdSummary (
|
||||||
today.end = now;
|
today.end = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tags = join(", ", track.tags());
|
|
||||||
|
|
||||||
if (show_ids)
|
if (show_ids)
|
||||||
{
|
{
|
||||||
table.set (row, 3, format ("@{1}", track.id), colorID);
|
table.set (row, 3, format ("@{1}", track.id), colorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
table.set (row, tags_col_index, tags, summaryIntervalColor (rules, track.tags ()));
|
if (show_tags)
|
||||||
|
{
|
||||||
|
std::string tags = join (", ", track.tags ());
|
||||||
|
table.set (row, tags_col_index, tags, summaryIntervalColor (rules, track.tags ()));
|
||||||
|
}
|
||||||
|
|
||||||
if (show_annotations)
|
if (show_annotations)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,8 @@ void initializeEntities (CLI& cli)
|
||||||
cli.entity ("hint", ":fill");
|
cli.entity ("hint", ":fill");
|
||||||
cli.entity ("hint", ":ids");
|
cli.entity ("hint", ":ids");
|
||||||
cli.entity ("hint", ":no-ids");
|
cli.entity ("hint", ":no-ids");
|
||||||
|
cli.entity ("hint", ":tags");
|
||||||
|
cli.entity ("hint", ":no-tags");
|
||||||
cli.entity ("hint", ":annotations");
|
cli.entity ("hint", ":annotations");
|
||||||
cli.entity ("hint", ":no-annotations");
|
cli.entity ("hint", ":no-annotations");
|
||||||
cli.entity ("hint", ":holidays");
|
cli.entity ("hint", ":holidays");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue