mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdClear: Propagated cli, rules, database
This commit is contained in:
parent
97cf6dfddb
commit
0e23f222b9
3 changed files with 16 additions and 10 deletions
|
@ -25,19 +25,25 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
|
#include <timew.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdClear ()
|
int CmdClear (
|
||||||
|
const CLI& cli,
|
||||||
|
Rules& rules,
|
||||||
|
Database& database)
|
||||||
{
|
{
|
||||||
std::cout << "[clear: allows removal of tags form intervals]\n";
|
auto filter = getFilter (cli);
|
||||||
|
if (! filter.range.started () &&
|
||||||
|
filter.tags ().size () == 0)
|
||||||
|
throw std::string ("The 'clear' command refuses to delete all your data.");
|
||||||
|
|
||||||
// TODO Parse interval.
|
auto tracked = getTrackedIntervals (database, rules, filter);
|
||||||
// TODO Parser tags.
|
auto extent = outerRange (tracked);
|
||||||
// TODO Load all data.
|
|
||||||
// TODO Apply filter.
|
for (auto& interval : subset (extent, tracked))
|
||||||
// TODO For each interval.
|
std::cout << "# clear impacts " << interval.dump () << "\n";
|
||||||
// TODO Remove tags.
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <Extensions.h>
|
#include <Extensions.h>
|
||||||
|
|
||||||
int CmdCancel ( Rules&, Database& );
|
int CmdCancel ( Rules&, Database& );
|
||||||
int CmdClear ( );
|
int CmdClear (const CLI&, Rules&, Database& );
|
||||||
int CmdConfig (const CLI&, Rules& );
|
int CmdConfig (const CLI&, Rules& );
|
||||||
int CmdContinue ( Rules&, Database& );
|
int CmdContinue ( Rules&, Database& );
|
||||||
int CmdDefault ( Rules&, Database& );
|
int CmdDefault ( Rules&, Database& );
|
||||||
|
|
|
@ -227,7 +227,7 @@ int dispatchCommand (
|
||||||
// These signatures are æxpected to be all different, therefore no
|
// These signatures are æxpected to be all different, therefore no
|
||||||
// command to fn mapping.
|
// command to fn mapping.
|
||||||
if (command == "cancel") status = CmdCancel ( rules, database );
|
if (command == "cancel") status = CmdCancel ( rules, database );
|
||||||
else if (command == "clear") status = CmdClear ( );
|
else if (command == "clear") status = CmdClear (cli, rules, database );
|
||||||
else if (command == "config") status = CmdConfig (cli, rules );
|
else if (command == "config") status = CmdConfig (cli, rules );
|
||||||
else if (command == "continue") status = CmdContinue ( rules, database );
|
else if (command == "continue") status = CmdContinue ( rules, database );
|
||||||
else if (command == "day") status = CmdReportDay (cli, rules, database );
|
else if (command == "day") status = CmdReportDay (cli, rules, database );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue