Enhancement - parse sequence like 1,3,5-10 for IDs

- Now parses sequences as well as IDs.
- Sequences implemented for the info report.
This commit is contained in:
Paul Beckingham 2009-05-05 01:59:07 -04:00
parent d135dc2337
commit fb674a5626
5 changed files with 52 additions and 37 deletions

View file

@ -265,35 +265,38 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf)
std::vector <T> tasks;
tdb.allPendingT (tasks);
Table table;
table.setTableWidth (width);
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
table.addColumn ("Name");
table.addColumn ("Value");
if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false))
{
table.setColumnUnderline (0);
table.setColumnUnderline (1);
}
else
table.setTableDashedUnderline ();
table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, Table::flexible);
table.setColumnJustification (0, Table::left);
table.setColumnJustification (1, Table::left);
// Find the task.
int count = 0;
for (unsigned int i = 0; i < tasks.size (); ++i)
{
T refTask (tasks[i]);
if (refTask.getId () == task.getId ())
if (refTask.getId () == task.getId () ||
task.inSequence (refTask.getId ()))
{
Date now;
++count;
Table table;
table.setTableWidth (width);
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
table.addColumn ("Name");
table.addColumn ("Value");
if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false))
{
table.setColumnUnderline (0);
table.setColumnUnderline (1);
}
else
table.setTableDashedUnderline ();
table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, Table::flexible);
table.setColumnJustification (0, Table::left);
table.setColumnJustification (1, Table::left);
Date now;
int row = table.addRow ();
table.addCell (row, 0, "ID");
@ -440,14 +443,14 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf)
}
table.addCell (row, 1, entry + " (" + age + ")");
out << optionalBlankLine (conf)
<< table.render ()
<< std::endl;
}
}
if (table.rowCount ())
out << optionalBlankLine (conf)
<< table.render ()
<< std::endl;
else
if (! count)
out << "No matches." << std::endl;
return out.str ();