From 395f6e702066b65f05c45d2b92cd4baab3dd62cb Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Sat, 8 Nov 2014 06:24:03 +0900 Subject: Implement help command for dicttoolkit. Bug: 10059681 Change-Id: I0cadf1f80103136cdac5c00b6fca4d81b4bf7384 --- .../src/command_executors/help_executor.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'native/dicttoolkit/src/command_executors/help_executor.cpp') diff --git a/native/dicttoolkit/src/command_executors/help_executor.cpp b/native/dicttoolkit/src/command_executors/help_executor.cpp index dba9f79fc..bd29a5b16 100644 --- a/native/dicttoolkit/src/command_executors/help_executor.cpp +++ b/native/dicttoolkit/src/command_executors/help_executor.cpp @@ -17,6 +17,14 @@ #include "command_executors/help_executor.h" #include +#include +#include + +#include "command_executors/diff_executor.h" +#include "command_executors/header_executor.h" +#include "command_executors/info_executor.h" +#include "command_executors/makedict_executor.h" +#include "utils/command_utils.h" namespace latinime { namespace dicttoolkit { @@ -24,9 +32,21 @@ namespace dicttoolkit { const char *const HelpExecutor::COMMAND_NAME = "help"; /* static */ int HelpExecutor::run(const int argc, char **argv) { - fprintf(stderr, "Command '%s' has not been implemented yet.\n", COMMAND_NAME); + printf("Available commands:\n\n"); + const std::vector> printUsageMethods = {DiffExecutor::printUsage, + HeaderExecutor::printUsage, InfoExecutor::printUsage, MakedictExecutor::printUsage, + printUsage}; + for (const auto &printUsageMethod : printUsageMethods) { + printUsageMethod(); + } return 0; } +/* static */ void HelpExecutor::printUsage() { + printf("*** %s\n", COMMAND_NAME); + printf("Usage: %s\n", COMMAND_NAME); + printf("Show this help list.\n\n"); +} + } // namespace dicttoolkit } // namespace latinime -- cgit v1.2.3-83-g751a