am 0c1822df: Merge "Implement help command for dicttoolkit."
* commit '0c1822df5bec37a71123118561fd3fb385404647': Implement help command for dicttoolkit.main
commit
e7c12210d9
|
@ -28,5 +28,11 @@ const char *const DiffExecutor::COMMAND_NAME = "diff";
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void DiffExecutor::printUsage() {
|
||||
printf("*** %s\n", COMMAND_NAME);
|
||||
printf("Usage: %s\n", COMMAND_NAME);
|
||||
printf("Shows differences between two dictionaries.\n\n");
|
||||
}
|
||||
|
||||
} // namespace dicttoolkit
|
||||
} // namespace latinime
|
||||
|
|
|
@ -27,6 +27,7 @@ class DiffExecutor final {
|
|||
static const char *const COMMAND_NAME;
|
||||
|
||||
static int run(const int argc, char **argv);
|
||||
static void printUsage();
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(DiffExecutor);
|
||||
|
|
|
@ -28,5 +28,11 @@ const char *const HeaderExecutor::COMMAND_NAME = "header";
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void HeaderExecutor::printUsage() {
|
||||
printf("*** %s\n", COMMAND_NAME);
|
||||
printf("Usage: %s\n", COMMAND_NAME);
|
||||
printf("Prints the header contents of a dictionary file.\n\n");
|
||||
}
|
||||
|
||||
} // namespace dicttoolkit
|
||||
} // namespace latinime
|
||||
|
|
|
@ -27,6 +27,7 @@ class HeaderExecutor final {
|
|||
static const char *const COMMAND_NAME;
|
||||
|
||||
static int run(const int argc, char **argv);
|
||||
static void printUsage();
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderExecutor);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,6 +27,7 @@ class HelpExecutor final {
|
|||
static const char *const COMMAND_NAME;
|
||||
|
||||
static int run(const int argc, char **argv);
|
||||
static void printUsage();
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(HelpExecutor);
|
||||
|
|
|
@ -28,5 +28,11 @@ const char *const InfoExecutor::COMMAND_NAME = "info";
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void InfoExecutor::printUsage() {
|
||||
printf("*** %s\n", COMMAND_NAME);
|
||||
printf("Usage: %s\n", COMMAND_NAME);
|
||||
printf("Prints various information about a dictionary file.\n\n");
|
||||
}
|
||||
|
||||
} // namespace dicttoolkit
|
||||
} // namespace latinime
|
||||
|
|
|
@ -27,6 +27,7 @@ class InfoExecutor final {
|
|||
static const char *const COMMAND_NAME;
|
||||
|
||||
static int run(const int argc, char **argv);
|
||||
static void printUsage();
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(InfoExecutor);
|
||||
|
|
|
@ -28,5 +28,13 @@ const char *const MakedictExecutor::COMMAND_NAME = "makedict";
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ void MakedictExecutor::printUsage() {
|
||||
printf("*** %s\n", COMMAND_NAME);
|
||||
printf("Usage: %s\n", COMMAND_NAME);
|
||||
printf("Converts a source dictionary file to one or several outputs.\n"
|
||||
"Source can be a binary dictionary file or a combined format file.\n"
|
||||
"Binary version 2 (Jelly Bean), 4, and combined format outputs are supported.\n\n");
|
||||
}
|
||||
|
||||
} // namespace dicttoolkit
|
||||
} // namespace latinime
|
||||
|
|
|
@ -27,6 +27,7 @@ class MakedictExecutor final {
|
|||
static const char *const COMMAND_NAME;
|
||||
|
||||
static int run(const int argc, char **argv);
|
||||
static void printUsage();
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(MakedictExecutor);
|
||||
|
|
Loading…
Reference in New Issue