diff options
author | 2014-11-08 06:24:03 +0900 | |
---|---|---|
committer | 2014-11-11 00:18:25 +0900 | |
commit | 395f6e702066b65f05c45d2b92cd4baab3dd62cb (patch) | |
tree | 201930cf49f39f948e81f9471211c82096018ef8 /native/dicttoolkit/src/command_executors/help_executor.cpp | |
parent | 61280c0b7fc87cf901272f38b75d12c5193b33ff (diff) | |
download | latinime-395f6e702066b65f05c45d2b92cd4baab3dd62cb.tar.gz latinime-395f6e702066b65f05c45d2b92cd4baab3dd62cb.tar.xz latinime-395f6e702066b65f05c45d2b92cd4baab3dd62cb.zip |
Implement help command for dicttoolkit.
Bug: 10059681
Change-Id: I0cadf1f80103136cdac5c00b6fca4d81b4bf7384
Diffstat (limited to 'native/dicttoolkit/src/command_executors/help_executor.cpp')
-rw-r--r-- | native/dicttoolkit/src/command_executors/help_executor.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
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 <cstdio> +#include <functional> +#include <vector> + +#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<std::function<void(void)>> 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 |