mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Report date format
Added report.X.dateformat which gives each report the possibility to have a custom format for the due dates.
This commit is contained in:
parent
4f70969306
commit
fccd0d6c96
5 changed files with 51 additions and 10 deletions
|
@ -154,9 +154,14 @@ tag names you have used, or just the ones used in active tasks.
|
|||
.B dateformat=m/d/Y
|
||||
.TP
|
||||
.B reportdateformat=m/d/Y
|
||||
This is a string of characters that define how task formats dates. If
|
||||
.B reportdateformat
|
||||
is set it will be used for the due date in the output of reports and "task info".
|
||||
.TP
|
||||
.B report.X.dateformat=m/d/Y
|
||||
This is a string of characters that define how task formats dates. The precedence order
|
||||
for the configuration variable is report.X.dateformat then reportdateformat then dateformat.
|
||||
While report.X.dateformat only formats the due date in reports, does reportdateformat format
|
||||
the due date both in reports and "task info". If both of these are not set then dateformat
|
||||
will be applied to the due date. Input dates as well as all other dates in reports are formatted
|
||||
according to dateformat.
|
||||
|
||||
The default value is: m/d/Y. The string should contain the characters
|
||||
|
||||
|
@ -458,6 +463,13 @@ descending sort order. The sort IDs are separated by commas
|
|||
This adds a filter to the report X so that only tasks matching the filter criteria
|
||||
are displayed in the generated report.
|
||||
|
||||
.TP
|
||||
.B report.X.dateformat
|
||||
This adds a dateformat to the report X that will be used by the "due date" column. If
|
||||
it is not set then reportdateformat and dateformat will be used in this order. See the
|
||||
.B DATES
|
||||
section for details on the sequence placeholders.
|
||||
|
||||
.TP
|
||||
.B report.X.limit
|
||||
An optional value to a report limiting the number of displayed tasks in the
|
||||
|
|
|
@ -67,11 +67,11 @@ std::string Config::defaults =
|
|||
"# Dates\n"
|
||||
"dateformat=m/d/Y # Preferred input and display date format\n"
|
||||
"#reportdateformat=m/d/Y # Preferred display date format for repors\n"
|
||||
"weekstart=Sunday # Sunday or Monday only\n" // TODO
|
||||
"displayweeknumber=yes # Show week numbers on calendar\n" // TODO
|
||||
"weekstart=Sunday # Sunday or Monday only\n"
|
||||
"displayweeknumber=yes # Show week numbers on calendar\n"
|
||||
"due=7 # Task is considered due in 7 days\n"
|
||||
"#calendar.details=yes # Calendar shows information for tasks w/due dates\n"
|
||||
"#calendar.details.report=list # Report to use when showing task information in cal\n" // TODO
|
||||
"#calendar.details.report=list # Report to use when showing task information in cal\n"
|
||||
"#monthsperline=3 # Number of calendar months on a line\n" // TODO
|
||||
"\n"
|
||||
"# Color controls.\n"
|
||||
|
@ -108,7 +108,7 @@ std::string Config::defaults =
|
|||
"\n"
|
||||
"#default.project=foo # Default project for 'add' command\n"
|
||||
"#default.priority=M # Default priority for 'add' command\n"
|
||||
"default.command=list # When no arguments are specified\n" // TODO
|
||||
"default.command=list # When no arguments are specified\n"
|
||||
"\n"
|
||||
"_forcecolor=no # Forces color to be on, even for non TTY output\n"
|
||||
"blanklines=true # Use more whitespace in output\n"
|
||||
|
@ -144,6 +144,7 @@ std::string Config::defaults =
|
|||
"# Description: This report is ...\n"
|
||||
"# Sort: due+,priority-,project+\n"
|
||||
"# Filter: pro:x pri:H +bug limit:10\n"
|
||||
"# Dateformat: due date format in reports\n"
|
||||
"\n"
|
||||
"# task long\n"
|
||||
"report.long.description=Lists all task, all data, matching the specified criteria\n"
|
||||
|
@ -151,6 +152,7 @@ std::string Config::defaults =
|
|||
"report.long.labels=ID,Project,Pri,Added,Started,Due,Recur,Age,Tags,Description\n"
|
||||
"report.long.sort=due+,priority-,project+\n"
|
||||
"report.long.filter=status:pending\n"
|
||||
"#report.long.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task list\n"
|
||||
"report.list.description=Lists all tasks matching the specified criteria\n"
|
||||
|
@ -158,6 +160,7 @@ std::string Config::defaults =
|
|||
"report.list.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.list.sort=due+,priority-,project+\n"
|
||||
"report.list.filter=status:pending\n"
|
||||
"#report.list.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task ls\n"
|
||||
"report.ls.description=Minimal listing of all tasks matching the specified criteria\n"
|
||||
|
@ -165,6 +168,7 @@ std::string Config::defaults =
|
|||
"report.ls.labels=ID,Project,Pri,Description\n"
|
||||
"report.ls.sort=priority-,project+\n"
|
||||
"report.ls.filter=status:pending\n"
|
||||
"#report.ls.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task minimal\n"
|
||||
"report.minimal.description=A really minimal listing\n"
|
||||
|
@ -172,6 +176,7 @@ std::string Config::defaults =
|
|||
"report.minimal.labels=ID,Project,Description\n"
|
||||
"report.minimal.sort=project+,description+\n"
|
||||
"report.minimal.filter=status:pending\n"
|
||||
"#report.minimal.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task newest\n"
|
||||
"report.newest.description=Shows the newest tasks\n"
|
||||
|
@ -179,6 +184,7 @@ std::string Config::defaults =
|
|||
"report.newest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.newest.sort=id-\n"
|
||||
"report.newest.filter=status:pending limit:10\n"
|
||||
"#report.newest.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task oldest\n"
|
||||
"report.oldest.description=Shows the oldest tasks\n"
|
||||
|
@ -186,6 +192,7 @@ std::string Config::defaults =
|
|||
"report.oldest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.oldest.sort=id+\n"
|
||||
"report.oldest.filter=status:pending limit:10\n"
|
||||
"#report.oldest.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task overdue\n"
|
||||
"report.overdue.description=Lists overdue tasks matching the specified criteria\n"
|
||||
|
@ -193,6 +200,7 @@ std::string Config::defaults =
|
|||
"report.overdue.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.overdue.sort=due+,priority-,project+\n"
|
||||
"report.overdue.filter=status:pending due.before:today\n"
|
||||
"#report.overdue.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task active\n"
|
||||
"report.active.description=Lists active tasks matching the specified criteria\n"
|
||||
|
@ -200,6 +208,7 @@ std::string Config::defaults =
|
|||
"report.active.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.active.sort=due+,priority-,project+\n"
|
||||
"report.active.filter=status:pending start.any:\n"
|
||||
"#report.active.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task completed\n"
|
||||
"report.completed.description=Lists completed tasks matching the specified criteria\n"
|
||||
|
@ -207,6 +216,7 @@ std::string Config::defaults =
|
|||
"report.completed.labels=Complete,Project,Pri,Age,Description\n"
|
||||
"report.completed.sort=end+,priority-,project+\n"
|
||||
"report.completed.filter=status:completed\n"
|
||||
"#report.completed.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task recurring\n"
|
||||
"report.recurring.description=Lists recurring tasks matching the specified criteria\n"
|
||||
|
@ -214,6 +224,7 @@ std::string Config::defaults =
|
|||
"report.recurring.labels=ID,Project,Pri,Due,Recur,Active,Age,Description\n"
|
||||
"report.recurring.sort=due+,priority-,project+\n"
|
||||
"report.recurring.filter=status:pending parent.any:\n"
|
||||
"#report.recurring.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task waiting\n"
|
||||
"report.waiting.description=Lists all waiting tasks matching the specified criteria\n"
|
||||
|
@ -221,12 +232,14 @@ std::string Config::defaults =
|
|||
"report.waiting.labels=ID,Project,Pri,Wait,Age,Description\n"
|
||||
"report.waiting.sort=wait+,priority-,project+\n"
|
||||
"report.waiting.filter=status:waiting\n"
|
||||
"#report.waiting.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task all\n"
|
||||
"report.all.description=Lists all tasks matching the specified criteria\n"
|
||||
"report.all.columns=id,project,priority,due,active,age,description\n"
|
||||
"report.all.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.all.sort=due+,priority-,project+\n"
|
||||
"#report.all.dateformat=m/d/Y\n"
|
||||
"\n"
|
||||
"# task next\n"
|
||||
"report.next.description=Lists the most urgent tasks\n"
|
||||
|
@ -234,6 +247,7 @@ std::string Config::defaults =
|
|||
"report.next.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||
"report.next.sort=due+,priority-,project+\n"
|
||||
"report.next.filter=status:pending\n"
|
||||
"#report.next.dateformat=m/d/Y\n"
|
||||
"\n";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -644,6 +644,12 @@ void Table::setDateFormat (const std::string& dateFormat)
|
|||
mDateFormat = dateFormat;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Table::setReportName (const std::string& reportName)
|
||||
{
|
||||
mReportName = reportName;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Table::rowCount ()
|
||||
{
|
||||
|
@ -881,7 +887,9 @@ void Table::sort (std::vector <int>& order)
|
|||
|
||||
else
|
||||
{
|
||||
std::string format = context.config.get ("reportdateformat");
|
||||
std::string format = context.config.get ("report." + mReportName + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("reportdateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
|
||||
|
@ -903,7 +911,9 @@ void Table::sort (std::vector <int>& order)
|
|||
|
||||
else
|
||||
{
|
||||
std::string format = context.config.get ("reportdateformat");
|
||||
std::string format = context.config.get ("report." + mReportName + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("reportdateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
|
||||
void suppressWS ();
|
||||
void setDateFormat (const std::string&);
|
||||
void setReportName (const std::string&);
|
||||
|
||||
int rowCount ();
|
||||
int columnCount ();
|
||||
|
@ -135,6 +136,7 @@ private:
|
|||
// Misc...
|
||||
bool mSuppressWS;
|
||||
std::string mDateFormat;
|
||||
std::string mReportName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -162,6 +162,7 @@ int runCustomReport (
|
|||
Table table;
|
||||
table.setTableWidth (context.getWidth ());
|
||||
table.setDateFormat (context.config.get ("dateformat"));
|
||||
table.setReportName (report);
|
||||
|
||||
foreach (task, tasks)
|
||||
table.addRow ();
|
||||
|
@ -360,7 +361,9 @@ int runCustomReport (
|
|||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::left);
|
||||
|
||||
std::string format = context.config.get ("reportdateformat");
|
||||
std::string format = context.config.get ("report." + report + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("reportdateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue