CmdStop: Converted to CLI

This commit is contained in:
Paul Beckingham 2016-04-03 22:09:03 -04:00
parent eeb848d809
commit 20e4ec2701
3 changed files with 7 additions and 8 deletions

View file

@ -32,7 +32,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdStop ( int CmdStop (
const std::vector <std::string>& args, CLI& cli,
Rules& rules, Rules& rules,
Database& database, Database& database,
Log& log) Log& log)
@ -59,10 +59,11 @@ int CmdStop (
// If tags were specified, and after removing those tags, there are still // If tags were specified, and after removing those tags, there are still
// tags remaining, then add a contiguous interval. // tags remaining, then add a contiguous interval.
if (args.size () > 2) auto words = cli.getWords ();
if (words.size ())
{ {
for (auto& tag : std::vector <std::string> (args.begin () + 2, args.end ())) for (auto& word : words)
latest.untag (tag); latest.untag (word);
if (latest.tags ().size ()) if (latest.tags ().size ())
{ {

View file

@ -32,8 +32,6 @@
#include <Database.h> #include <Database.h>
#include <Extensions.h> #include <Extensions.h>
#include <Log.h> #include <Log.h>
#include <vector>
#include <string>
int CmdClear ( ); int CmdClear ( );
int CmdConfig ( ); int CmdConfig ( );
@ -50,7 +48,7 @@ int CmdLog (CLI&, Log&);
int CmdImport ( ); int CmdImport ( );
int CmdReport (CLI&, Rules&, Database&, Extensions&, Log&); int CmdReport (CLI&, Rules&, Database&, Extensions&, Log&);
int CmdStart (CLI&, Rules&, Database&, Log&); int CmdStart (CLI&, Rules&, Database&, Log&);
int CmdStop (const std::vector <std::string>&, Rules&, Database&, Log&); int CmdStop (CLI&, Rules&, Database&, Log&);
int CmdTags ( Rules&, Database&, Log&); int CmdTags ( Rules&, Database&, Log&);
int CmdTrack ( ); int CmdTrack ( );
int CmdUndo ( ); int CmdUndo ( );

View file

@ -225,7 +225,7 @@ int dispatchCommand (
else if (command == "log") status = CmdLog (cli, log); else if (command == "log") status = CmdLog (cli, log);
else if (command == "report") status = CmdReport (cli, rules, database, extensions, log); else if (command == "report") status = CmdReport (cli, rules, database, extensions, log);
else if (command == "start") status = CmdStart (cli, rules, database, log); else if (command == "start") status = CmdStart (cli, rules, database, log);
else if (command == "stop") status = CmdStop (args, rules, database, log); else if (command == "stop") status = CmdStop (cli, rules, database, log);
else if (command == "tags") status = CmdTags ( rules, database, log); else if (command == "tags") status = CmdTags ( rules, database, log);
else if (command == "track") status = CmdTrack ( ); else if (command == "track") status = CmdTrack ( );
else if (command == "undo") status = CmdUndo ( ); else if (command == "undo") status = CmdUndo ( );