mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdReport: Applies filter
This commit is contained in:
parent
e7de3b70da
commit
1a98a52cbf
1 changed files with 30 additions and 39 deletions
|
@ -70,36 +70,30 @@ int CmdReport (
|
|||
Database& database,
|
||||
const Extensions& extensions)
|
||||
{
|
||||
// TODO Identify report.
|
||||
auto words = cli.getWords ();
|
||||
if (words.size ())
|
||||
{
|
||||
auto script = findExtension (extensions, words[0]);
|
||||
std::string script;
|
||||
for (auto& arg : cli._args)
|
||||
if (arg.hasTag ("EXT"))
|
||||
script = findExtension (extensions, arg.attribute ("canonical"));
|
||||
|
||||
// TODO Default report?
|
||||
if (script == "")
|
||||
throw std::string ("Specify which report to run.");
|
||||
|
||||
// Load all data.
|
||||
auto intervals = database.getAllIntervals ();
|
||||
|
||||
// TODO Apply filter.
|
||||
// Filter the data.
|
||||
auto filter = createFilterFromCLI (cli);
|
||||
auto timeline = createTimelineFromData (rules, database, filter);
|
||||
auto intervals = timeline.tracked (rules);
|
||||
|
||||
// Compose Header info.
|
||||
std::stringstream header;
|
||||
// TODO Filter.
|
||||
// TODO CLI.
|
||||
// TODO Directory containing *.data files.
|
||||
|
||||
// All configuration.
|
||||
std::stringstream header;
|
||||
for (auto& name : rules.all ())
|
||||
header << name << "=" << rules.get (name) << "\n";
|
||||
|
||||
// Compose JSON.
|
||||
auto json = jsonFromIntervals (intervals);
|
||||
|
||||
// Compose the input for the script.
|
||||
auto input = header.str ()
|
||||
+ "\n"
|
||||
+ json;
|
||||
+ jsonFromIntervals (intervals);
|
||||
|
||||
// Run the extensions.
|
||||
std::vector <std::string> output;
|
||||
|
@ -108,9 +102,6 @@ int CmdReport (
|
|||
// Display the output.
|
||||
for (auto& line : output)
|
||||
std::cout << line << "\n";
|
||||
}
|
||||
else
|
||||
throw std::string ("Specify which report to run.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue