- Beginning to fill out processing of the generalized custom report.
This commit is contained in:
@@ -2679,14 +2679,51 @@ std::string handleCustomReport (
|
|||||||
Config& conf,
|
Config& conf,
|
||||||
const std::string& report)
|
const std::string& report)
|
||||||
{
|
{
|
||||||
std::cout << "# woohoo!" << std::endl;
|
// Determine window size, and set table accordingly.
|
||||||
|
int width = conf.get ("defaultwidth", 80);
|
||||||
|
#ifdef HAVE_LIBNCURSES
|
||||||
|
if (conf.get ("curses", true))
|
||||||
|
{
|
||||||
|
WINDOW* w = initscr ();
|
||||||
|
width = w->_maxx + 1;
|
||||||
|
endwin ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Load report configuration.
|
||||||
|
std::string columnList = conf.get ("report." + report + ".columns");
|
||||||
|
std::vector <std::string> columns;
|
||||||
|
split (columns, columnList, ',');
|
||||||
|
|
||||||
|
std::string sortList = conf.get ("report." + report + ".sort");
|
||||||
|
std::vector <std::string> sortOrder;
|
||||||
|
split (sortOrder, sortList, ',');
|
||||||
|
|
||||||
|
std::string filter = conf.get ("report." + report + ".filter");
|
||||||
|
|
||||||
|
std::cout << "# columns " << columnList << std::endl
|
||||||
|
<< "# sort " << sortList << std::endl
|
||||||
|
<< "# filter " << filter << std::endl;
|
||||||
|
|
||||||
|
Table table;
|
||||||
|
table.setTableWidth (width);
|
||||||
|
|
||||||
|
// TODO Load pending tasks.
|
||||||
|
// TODO Apply filters.
|
||||||
|
// TODO Add columns.
|
||||||
|
// TODO Add data.
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
if (table.rowCount ())
|
||||||
// TODO Load columns.
|
out << optionalBlankLine (conf)
|
||||||
// TODO Load sort order.
|
<< table.render ()
|
||||||
|
<< optionalBlankLine (conf)
|
||||||
|
<< table.rowCount ()
|
||||||
|
<< (table.rowCount () == 1 ? " task" : " tasks")
|
||||||
|
<< std::endl;
|
||||||
|
else
|
||||||
|
out << "No matches."
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user