diff options
author | 2014-11-10 21:57:09 +0000 | |
---|---|---|
committer | 2014-11-10 21:57:09 +0000 | |
commit | e7c12210d95c9a2df93f699adaf7b540d17d5338 (patch) | |
tree | b028debeb13f8bcf3250c56e7167a14b03551869 /native/dicttoolkit/src/command_executors/help_executor.cpp | |
parent | 75825abc72026f2b48c5ebb016fa1fb86571a103 (diff) | |
parent | 0c1822df5bec37a71123118561fd3fb385404647 (diff) | |
download | latinime-e7c12210d95c9a2df93f699adaf7b540d17d5338.tar.gz latinime-e7c12210d95c9a2df93f699adaf7b540d17d5338.tar.xz latinime-e7c12210d95c9a2df93f699adaf7b540d17d5338.zip |
am 0c1822df: Merge "Implement help command for dicttoolkit."
* commit '0c1822df5bec37a71123118561fd3fb385404647':
Implement help command for dicttoolkit.
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 |