Implement help command for dicttoolkit.
Bug: 10059681 Change-Id: I0cadf1f80103136cdac5c00b6fca4d81b4bf7384
This commit is contained in:
parent
61280c0b7f
commit
395f6e7020
10 changed files with 52 additions and 1 deletions
|
@ -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 a new issue