CmdReport: Composes extension input, runs extension, displays output

This commit is contained in:
Paul Beckingham 2016-03-26 12:40:31 -04:00
parent fd44d6f35f
commit b56c266990

View file

@ -70,14 +70,19 @@ int CmdReport (
Extensions& extensions,
Log& log)
{
// TODO Identify report.
if (args.size () > 2)
{
auto script = findExtension (extensions, args[2]);
// TODO Default report?
// Load all data.
auto intervals = database.getAllIntervals ();
// TODO Apply filter.
// TODO Identify report.
// TODO Compose Header info.
// Compose Header info.
std::stringstream header;
// TODO Configuration.
// TODO Exclusions.
@ -104,13 +109,19 @@ int CmdReport (
json << "]\n";
// TODO Run report.
// Compose the input for the script.
auto input = header.str ()
+ "\n"
+ json.str ();
// Run the extensions.
std::vector <std::string> output;
// extensions.callExtension (pathToScript, split (input, '\n'), output);
extensions.callExtension (script, split (input, '\n'), output);
// Display the output.
for (auto& line : output)
std::cout << line << "\n";
}
return 0;
}