mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdReport: Composes extension input, runs extension, displays output
This commit is contained in:
parent
fd44d6f35f
commit
b56c266990
1 changed files with 48 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue