mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-30 22:43:24 +02:00
Clean up annotation details
- changed variable name from annotation.details to annotations - added report.X.annotations - changed values from 2, 1, 0 to full, sparse, none - made reportdateformat available in timesheet
This commit is contained in:
parent
fccd0d6c96
commit
ab86490b37
7 changed files with 63 additions and 30 deletions
|
@ -59,7 +59,7 @@ std::string Config::defaults =
|
|||
"# Miscellaneous\n"
|
||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||
"echo.command=yes # Details on command just run\n"
|
||||
"annotation.details=2 # Level of verbosity for annotations in reports\n"
|
||||
"annotations=full # Level of verbosity for annotations in reports\n"
|
||||
"next=2 # How many tasks per project in next report\n"
|
||||
"bulk=2 # > 2 tasks considered 'a lot', for confirmation\n"
|
||||
"nag=You have higher priority tasks. # Nag message to keep you honest\n" // TODO
|
||||
|
@ -153,6 +153,7 @@ std::string Config::defaults =
|
|||
"report.long.sort=due+,priority-,project+\n"
|
||||
"report.long.filter=status:pending\n"
|
||||
"#report.long.dateformat=m/d/Y\n"
|
||||
"#report.long.annotations=full\n"
|
||||
"\n"
|
||||
"# task list\n"
|
||||
"report.list.description=Lists all tasks matching the specified criteria\n"
|
||||
|
@ -161,6 +162,7 @@ std::string Config::defaults =
|
|||
"report.list.sort=due+,priority-,project+\n"
|
||||
"report.list.filter=status:pending\n"
|
||||
"#report.list.dateformat=m/d/Y\n"
|
||||
"#report.list.annotations=full\n"
|
||||
"\n"
|
||||
"# task ls\n"
|
||||
"report.ls.description=Minimal listing of all tasks matching the specified criteria\n"
|
||||
|
@ -169,6 +171,7 @@ std::string Config::defaults =
|
|||
"report.ls.sort=priority-,project+\n"
|
||||
"report.ls.filter=status:pending\n"
|
||||
"#report.ls.dateformat=m/d/Y\n"
|
||||
"#report.ls.annotations=full\n"
|
||||
"\n"
|
||||
"# task minimal\n"
|
||||
"report.minimal.description=A really minimal listing\n"
|
||||
|
@ -177,6 +180,7 @@ std::string Config::defaults =
|
|||
"report.minimal.sort=project+,description+\n"
|
||||
"report.minimal.filter=status:pending\n"
|
||||
"#report.minimal.dateformat=m/d/Y\n"
|
||||
"#report.minimal.annotations=full\n"
|
||||
"\n"
|
||||
"# task newest\n"
|
||||
"report.newest.description=Shows the newest tasks\n"
|
||||
|
@ -185,6 +189,7 @@ std::string Config::defaults =
|
|||
"report.newest.sort=id-\n"
|
||||
"report.newest.filter=status:pending limit:10\n"
|
||||
"#report.newest.dateformat=m/d/Y\n"
|
||||
"#report.newest.annotations=full\n"
|
||||
"\n"
|
||||
"# task oldest\n"
|
||||
"report.oldest.description=Shows the oldest tasks\n"
|
||||
|
@ -193,6 +198,7 @@ std::string Config::defaults =
|
|||
"report.oldest.sort=id+\n"
|
||||
"report.oldest.filter=status:pending limit:10\n"
|
||||
"#report.oldest.dateformat=m/d/Y\n"
|
||||
"#report.oldest.annotations=full\n"
|
||||
"\n"
|
||||
"# task overdue\n"
|
||||
"report.overdue.description=Lists overdue tasks matching the specified criteria\n"
|
||||
|
@ -201,6 +207,7 @@ std::string Config::defaults =
|
|||
"report.overdue.sort=due+,priority-,project+\n"
|
||||
"report.overdue.filter=status:pending due.before:today\n"
|
||||
"#report.overdue.dateformat=m/d/Y\n"
|
||||
"#report.overdue.annotations=full\n"
|
||||
"\n"
|
||||
"# task active\n"
|
||||
"report.active.description=Lists active tasks matching the specified criteria\n"
|
||||
|
@ -209,6 +216,7 @@ std::string Config::defaults =
|
|||
"report.active.sort=due+,priority-,project+\n"
|
||||
"report.active.filter=status:pending start.any:\n"
|
||||
"#report.active.dateformat=m/d/Y\n"
|
||||
"#report.active.annotations=full\n"
|
||||
"\n"
|
||||
"# task completed\n"
|
||||
"report.completed.description=Lists completed tasks matching the specified criteria\n"
|
||||
|
@ -217,6 +225,7 @@ std::string Config::defaults =
|
|||
"report.completed.sort=end+,priority-,project+\n"
|
||||
"report.completed.filter=status:completed\n"
|
||||
"#report.completed.dateformat=m/d/Y\n"
|
||||
"#report.completed.annotations=full\n"
|
||||
"\n"
|
||||
"# task recurring\n"
|
||||
"report.recurring.description=Lists recurring tasks matching the specified criteria\n"
|
||||
|
@ -225,6 +234,7 @@ std::string Config::defaults =
|
|||
"report.recurring.sort=due+,priority-,project+\n"
|
||||
"report.recurring.filter=status:pending parent.any:\n"
|
||||
"#report.recurring.dateformat=m/d/Y\n"
|
||||
"#report.recurring.annotations=full\n"
|
||||
"\n"
|
||||
"# task waiting\n"
|
||||
"report.waiting.description=Lists all waiting tasks matching the specified criteria\n"
|
||||
|
@ -233,6 +243,7 @@ std::string Config::defaults =
|
|||
"report.waiting.sort=wait+,priority-,project+\n"
|
||||
"report.waiting.filter=status:waiting\n"
|
||||
"#report.waiting.dateformat=m/d/Y\n"
|
||||
"#report.waiting.annotations=full\n"
|
||||
"\n"
|
||||
"# task all\n"
|
||||
"report.all.description=Lists all tasks matching the specified criteria\n"
|
||||
|
@ -240,6 +251,7 @@ std::string Config::defaults =
|
|||
"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"
|
||||
"#report.all.annotations=full\n"
|
||||
"\n"
|
||||
"# task next\n"
|
||||
"report.next.description=Lists the most urgent tasks\n"
|
||||
|
@ -248,6 +260,7 @@ std::string Config::defaults =
|
|||
"report.next.sort=due+,priority-,project+\n"
|
||||
"report.next.filter=status:pending\n"
|
||||
"#report.next.dateformat=m/d/Y\n"
|
||||
"#report.next.annotations=full\n"
|
||||
"\n";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -649,7 +649,7 @@ int handleConfig (std::string &outs)
|
|||
// These are the regular configuration variables.
|
||||
// Note that there is a leading and trailing space, to make searching easier.
|
||||
std::string recognized =
|
||||
" annotation.details blanklines bulk calendar.details calendar.details.report color "
|
||||
" annotations blanklines bulk calendar.details calendar.details.report color "
|
||||
"color.active color.due color.overdue color.pri.H color.pri.L color.pri.M color.pri.none "
|
||||
"color.recurring color.tagged color.footnote color.header color.debug color.alternate "
|
||||
"color.calendar.today color.calendar.due color.calendar.overdue color.calendar.weekend "
|
||||
|
|
|
@ -464,7 +464,7 @@ int runCustomReport (
|
|||
|
||||
int row = 0;
|
||||
foreach (task, tasks)
|
||||
table.addCell (row++, columnCount, getFullDescription (*task));
|
||||
table.addCell (row++, columnCount, getFullDescription (*task, report));
|
||||
}
|
||||
|
||||
else if (*col == "recur")
|
||||
|
|
|
@ -102,7 +102,7 @@ int handleReportGHistory (std::string &);
|
|||
int handleReportCalendar (std::string &);
|
||||
int handleReportStats (std::string &);
|
||||
int handleReportTimesheet (std::string &);
|
||||
std::string getFullDescription (Task&);
|
||||
std::string getFullDescription (Task&, const std::string&);
|
||||
std::string getDueDate (Task&, const std::string&);
|
||||
|
||||
// custom.cpp
|
||||
|
|
|
@ -353,7 +353,7 @@ int handleInfo (std::string &outs)
|
|||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 0, "Description");
|
||||
table.addCell (row, 1, getFullDescription (*task));
|
||||
table.addCell (row, 1, getFullDescription (*task, "info"));
|
||||
|
||||
if (task->has ("project"))
|
||||
{
|
||||
|
@ -1223,9 +1223,12 @@ int handleReportTimesheet (std::string &outs)
|
|||
if (compDate >= start && compDate < end)
|
||||
{
|
||||
int row = completed.addRow ();
|
||||
std::string format = context.config.get ("reportdateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
completed.addCell (row, 1, task->get ("project"));
|
||||
completed.addCell (row, 2, getDueDate (*task, context.config.get("dateformat")));
|
||||
completed.addCell (row, 3, getFullDescription (*task));
|
||||
completed.addCell (row, 2, getDueDate (*task, format));
|
||||
completed.addCell (row, 3, getFullDescription (*task, "timesheet"));
|
||||
|
||||
if (color)
|
||||
{
|
||||
|
@ -1279,9 +1282,12 @@ int handleReportTimesheet (std::string &outs)
|
|||
if (startDate >= start && startDate < end)
|
||||
{
|
||||
int row = started.addRow ();
|
||||
std::string format = context.config.get ("reportdateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
started.addCell (row, 1, task->get ("project"));
|
||||
started.addCell (row, 2, getDueDate (*task, context.config.get ("dateformat")));
|
||||
started.addCell (row, 3, getFullDescription (*task));
|
||||
started.addCell (row, 2, getDueDate (*task, format));
|
||||
started.addCell (row, 3, getFullDescription (*task, "timesheet"));
|
||||
|
||||
if (color)
|
||||
{
|
||||
|
@ -2109,38 +2115,43 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::string getFullDescription (Task& task)
|
||||
std::string getFullDescription (Task& task, const std::string& report)
|
||||
{
|
||||
std::string desc = task.get ("description");
|
||||
std::string annotationDetails;
|
||||
|
||||
std::vector <Att> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
|
||||
if (annotations.size () != 0)
|
||||
switch (context.config.getInteger ("annotation.details"))
|
||||
{
|
||||
std::string annotationDetails = context.config.get ("report." + report + ".annotations");
|
||||
if (annotationDetails == "")
|
||||
annotationDetails = context.config.get ("annotations");
|
||||
if (report == "info")
|
||||
annotationDetails = "full";
|
||||
|
||||
if (annotationDetails == "none")
|
||||
{
|
||||
case 0:
|
||||
desc = "+" + desc;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if (annotations.size () > 1)
|
||||
desc = "+" + desc;
|
||||
Att anno (annotations.back());
|
||||
Date dt (atoi (anno.name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat"));
|
||||
desc += "\n" + when + " " + anno.value ();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
}
|
||||
else if (annotationDetails == "sparse")
|
||||
{
|
||||
if (annotations.size () > 1)
|
||||
desc = "+" + desc;
|
||||
Att anno (annotations.back());
|
||||
Date dt (atoi (anno.name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat"));
|
||||
desc += "\n" + when + " " + anno.value ();
|
||||
}
|
||||
else
|
||||
foreach (anno, annotations)
|
||||
{
|
||||
Date dt (atoi (anno->name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat"));
|
||||
desc += "\n" + when + " " + anno->value ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ like ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'second annotation task
|
|||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms,'first annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotation.details:1 rrr};
|
||||
$output = qx{../task rc:annotate.rc rc.annotations:sparse rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
|
@ -102,7 +102,7 @@ like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'second annotation t
|
|||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms, 'third annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotation.details:0 rrr};
|
||||
$output = qx{../task rc:annotate.rc rc.annotations:none rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 \+three/, 'task 3');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue