aboutsummaryrefslogtreecommitdiffstats
path: root/native/dicttoolkit/src/command_executors/help_executor.cpp
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-11-10 18:53:18 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-10 18:53:19 +0000
commit0c1822df5bec37a71123118561fd3fb385404647 (patch)
treea4fa63924cdf7b52f12e30de9dac5f11cb5eaf06 /native/dicttoolkit/src/command_executors/help_executor.cpp
parentb23f03488f165565e46f8d1b742ee6629f9c0f52 (diff)
parent395f6e702066b65f05c45d2b92cd4baab3dd62cb (diff)
downloadlatinime-0c1822df5bec37a71123118561fd3fb385404647.tar.gz
latinime-0c1822df5bec37a71123118561fd3fb385404647.tar.xz
latinime-0c1822df5bec37a71123118561fd3fb385404647.zip
Merge "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.cpp22
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