From b3f40b700b8150cbb85ee6f352af86c716065fde Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 19 Mar 2016 18:04:18 -0400 Subject: [PATCH] init: Propagated extensions to CmdExtension - Also added missing dispatch. --- src/commands/CmdExtension.cpp | 3 ++- src/commands/commands.h | 3 ++- src/init.cpp | 37 ++++++++++++++++++----------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/commands/CmdExtension.cpp b/src/commands/CmdExtension.cpp index a1583c9d..60f56046 100644 --- a/src/commands/CmdExtension.cpp +++ b/src/commands/CmdExtension.cpp @@ -25,10 +25,11 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include //////////////////////////////////////////////////////////////////////////////// -int CmdExtension () +int CmdExtension (Extensions& extensions) { std::cout << "[extension: enumerate all extensions]\n"; diff --git a/src/commands/commands.h b/src/commands/commands.h index c72a9cdd..11614473 100644 --- a/src/commands/commands.h +++ b/src/commands/commands.h @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,7 @@ int CmdDefault (); int CmdDefine (Rules&); int CmdDiagnostics (Database&, Log&); int CmdExport (); -int CmdExtension (); +int CmdExtension (Extensions&); int CmdGaps (); int CmdHelpUsage (); int CmdHelp (const std::vector &, Log&); diff --git a/src/init.cpp b/src/init.cpp index db42d168..be07d625 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -181,9 +181,9 @@ int dispatchCommand ( { std::vector allCommands = { - "help", "clear", "config", "continue", "define", "diagnostics", "export", - "gaps", "import", "log", "report", "start", "stop", "tags", "track", - "undo" + "clear", "config", "continue", "define", "diagnostics", "export", + "extension", "gaps", "help", "import", "log", "report", "start", "stop", + "tags", "track", "undo" }; std::vector matches; @@ -192,22 +192,23 @@ int dispatchCommand ( { // These signatures are æxpected to be all different, therefore no // command to fn mapping. - if (closeEnough (allCommands[1], args[1], 2)) status = CmdClear (); - else if (closeEnough (allCommands[2], args[1], 2)) status = CmdConfig (); - else if (closeEnough (allCommands[3], args[1], 2)) status = CmdContinue (); - else if (closeEnough (allCommands[4], args[1], 2)) status = CmdDefine (rules); - else if (closeEnough (allCommands[5], args[1], 2)) status = CmdDiagnostics (database, log); - else if (closeEnough (allCommands[6], args[1], 2)) status = CmdExport (); + 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 (database, log); + else if (closeEnough (allCommands[5], args[1], 2)) status = CmdExport (); + else if (closeEnough (allCommands[6], args[1], 2)) status = CmdExtension (extensions); else if (closeEnough (allCommands[7], args[1], 2)) status = CmdGaps (); - else if (closeEnough (allCommands[0], args[1], 2)) status = CmdHelp (args, log); - else if (closeEnough (allCommands[8], args[1], 2)) status = CmdImport (); - else if (closeEnough (allCommands[9], args[1], 2)) status = CmdLog (args, log); - else if (closeEnough (allCommands[10], args[1], 2)) status = CmdReport (); - else if (closeEnough (allCommands[11], args[1], 2)) status = CmdStart (); - else if (closeEnough (allCommands[12], args[1], 2)) status = CmdStop (); - else if (closeEnough (allCommands[13], args[1], 2)) status = CmdTags (); - else if (closeEnough (allCommands[14], args[1], 2)) status = CmdTrack (); - else if (closeEnough (allCommands[15], args[1], 2)) status = CmdUndo (); + 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 (); } else if (matches.size () == 0) {