mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - new age_compact column
- Added support for a new custom report column called "age_compact", which is a more compact version of "age" (thanks to T. Charles Yun).
This commit is contained in:
parent
66bd5fc3c0
commit
ac871d9e8d
4 changed files with 46 additions and 0 deletions
|
@ -2669,6 +2669,27 @@ std::string handleCustomReport (
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "age_compact")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Age");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::right);
|
||||
|
||||
std::string created;
|
||||
std::string age;
|
||||
Date now;
|
||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||
{
|
||||
created = tasks[row].getAttribute ("entry");
|
||||
if (created.length ())
|
||||
{
|
||||
Date dt (::atoi (created.c_str ()));
|
||||
age = formatSecondsCompact ((time_t) (now - dt));
|
||||
table.addCell (row, columnCount, age);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "active")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Active");
|
||||
|
@ -2899,6 +2920,7 @@ void validReportColumns (const std::vector <std::string>& columns)
|
|||
*it != "start" &&
|
||||
*it != "due" &&
|
||||
*it != "age" &&
|
||||
*it != "age_compact" &&
|
||||
*it != "active" &&
|
||||
*it != "tags" &&
|
||||
*it != "recur" &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue