From fbe6584447f3247c283a274376f0e6f52d18d7e5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 20 Mar 2016 11:21:53 -0400 Subject: [PATCH] init: Propagated args, rules, database and log to CmdStart --- src/commands/CmdStart.cpp | 7 ++++++- src/commands/commands.h | 38 +++++++++++++++++++------------------- src/init.cpp | 34 +++++++++++++++++----------------- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/commands/CmdStart.cpp b/src/commands/CmdStart.cpp index 3ca188df..7bb67811 100644 --- a/src/commands/CmdStart.cpp +++ b/src/commands/CmdStart.cpp @@ -25,10 +25,15 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include //////////////////////////////////////////////////////////////////////////////// -int CmdStart () +int CmdStart ( + const std::vector & args, + Rules& rules, + Database& database, + Log& log) { std::cout << "[start: begin a new tracking interval]\n"; diff --git a/src/commands/commands.h b/src/commands/commands.h index ff034d10..35e704f9 100644 --- a/src/commands/commands.h +++ b/src/commands/commands.h @@ -34,24 +34,24 @@ #include #include -int CmdClear (); -int CmdConfig (); -int CmdContinue (); -int CmdDefault (); -int CmdDefine (Rules&); -int CmdDiagnostics (Rules&, Database&, Extensions&, Log&); -int CmdExport (); -int CmdExtensions (Rules&, Extensions&); -int CmdGaps (); -int CmdHelpUsage (); -int CmdHelp (const std::vector &, Log&); -int CmdLog (const std::vector &, Log&); -int CmdImport (); -int CmdReport (); -int CmdStart (); -int CmdStop (); -int CmdTags (); -int CmdTrack (); -int CmdUndo (); +int CmdClear ( ); +int CmdConfig ( ); +int CmdContinue ( ); +int CmdDefault ( ); +int CmdDefine ( Rules& ); +int CmdDiagnostics ( Rules&, Database&, Extensions&, Log&); +int CmdExport ( ); +int CmdExtensions ( Rules&, Extensions& ); +int CmdGaps ( ); +int CmdHelpUsage ( ); +int CmdHelp (const std::vector &, Log&); +int CmdLog (const std::vector &, Log&); +int CmdImport ( ); +int CmdReport ( ); +int CmdStart (const std::vector &, Rules&, Database&, Log&); +int CmdStop ( ); +int CmdTags ( ); +int CmdTrack ( ); +int CmdUndo ( ); #endif diff --git a/src/init.cpp b/src/init.cpp index c8e018ac..c85daa5d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -190,23 +190,23 @@ int dispatchCommand ( { // These signatures are æxpected to be all different, therefore no // command to fn mapping. - if (closeEnough (allCommands[0], args[1], 2)) status = CmdClear (); - else if (closeEnough (allCommands[1], args[1], 2)) status = CmdConfig (); - else if (closeEnough (allCommands[2], args[1], 2)) status = CmdContinue (); - else if (closeEnough (allCommands[3], args[1], 2)) status = CmdDefine (rules); - else if (closeEnough (allCommands[4], args[1], 2)) status = CmdDiagnostics (rules, database, extensions, log); - else if (closeEnough (allCommands[5], args[1], 2)) status = CmdExport (); - else if (closeEnough (allCommands[6], args[1], 2)) status = CmdExtensions (rules, extensions); - else if (closeEnough (allCommands[7], args[1], 2)) status = CmdGaps (); - else if (closeEnough (allCommands[8], args[1], 2)) status = CmdHelp (args, log); - else if (closeEnough (allCommands[9], args[1], 2)) status = CmdImport (); - else if (closeEnough (allCommands[10], args[1], 2)) status = CmdLog (args, log); - else if (closeEnough (allCommands[11], args[1], 2)) status = CmdReport (); - else if (closeEnough (allCommands[12], args[1], 2)) status = CmdStart (); - else if (closeEnough (allCommands[13], args[1], 2)) status = CmdStop (); - else if (closeEnough (allCommands[14], args[1], 2)) status = CmdTags (); - else if (closeEnough (allCommands[15], args[1], 2)) status = CmdTrack (); - else if (closeEnough (allCommands[16], args[1], 2)) status = CmdUndo (); + if (closeEnough (allCommands[0], args[1], 2)) status = CmdClear ( ); + else if (closeEnough (allCommands[1], args[1], 2)) status = CmdConfig ( ); + else if (closeEnough (allCommands[2], args[1], 2)) status = CmdContinue ( ); + else if (closeEnough (allCommands[3], args[1], 2)) status = CmdDefine ( rules ); + else if (closeEnough (allCommands[4], args[1], 2)) status = CmdDiagnostics ( rules, database, extensions, log); + else if (closeEnough (allCommands[5], args[1], 2)) status = CmdExport ( ); + else if (closeEnough (allCommands[6], args[1], 2)) status = CmdExtensions ( rules, extensions ); + else if (closeEnough (allCommands[7], args[1], 2)) status = CmdGaps ( ); + else if (closeEnough (allCommands[8], args[1], 2)) status = CmdHelp (args, log); + else if (closeEnough (allCommands[9], args[1], 2)) status = CmdImport ( ); + else if (closeEnough (allCommands[10], args[1], 2)) status = CmdLog (args, log); + else if (closeEnough (allCommands[11], args[1], 2)) status = CmdReport ( ); + else if (closeEnough (allCommands[12], args[1], 2)) status = CmdStart (args, rules, database, log); + else if (closeEnough (allCommands[13], args[1], 2)) status = CmdStop ( ); + else if (closeEnough (allCommands[14], args[1], 2)) status = CmdTags ( ); + else if (closeEnough (allCommands[15], args[1], 2)) status = CmdTrack ( ); + else if (closeEnough (allCommands[16], args[1], 2)) status = CmdUndo ( ); } else if (matches.size () == 0) {