mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 19:23:57 +00:00
Add -v --version arg support to the flatc command.
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
#include "flatbuffers/util.h"
|
#include "flatbuffers/util.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#define FLATC_VERSION "1.2.0"
|
||||||
|
|
||||||
static void Error(const std::string &err, bool usage = false,
|
static void Error(const std::string &err, bool usage = false,
|
||||||
bool show_exe_name = true);
|
bool show_exe_name = true);
|
||||||
|
|
||||||
@@ -97,6 +99,7 @@ static void Error(const std::string &err, bool usage, bool show_exe_name) {
|
|||||||
" -o PATH Prefix PATH to all generated files.\n"
|
" -o PATH Prefix PATH to all generated files.\n"
|
||||||
" -I PATH Search for includes in the specified path.\n"
|
" -I PATH Search for includes in the specified path.\n"
|
||||||
" -M Print make rules for generated files.\n"
|
" -M Print make rules for generated files.\n"
|
||||||
|
" -v, --version Print the version number of flatc and exit.\n"
|
||||||
" --strict-json Strict JSON: field names must be / will be quoted,\n"
|
" --strict-json Strict JSON: field names must be / will be quoted,\n"
|
||||||
" no trailing commas in tables/vectors.\n"
|
" no trailing commas in tables/vectors.\n"
|
||||||
" --defaults-json Output fields whose value is the default when\n"
|
" --defaults-json Output fields whose value is the default when\n"
|
||||||
@@ -188,6 +191,9 @@ int main(int argc, const char *argv[]) {
|
|||||||
schema_binary = true;
|
schema_binary = true;
|
||||||
} else if(arg == "-M") {
|
} else if(arg == "-M") {
|
||||||
print_make_rules = true;
|
print_make_rules = true;
|
||||||
|
} else if(arg == "-v" || arg == "--version") {
|
||||||
|
printf("flatc version %s\n", FLATC_VERSION);
|
||||||
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
for (size_t i = 0; i < num_generators; ++i) {
|
for (size_t i = 0; i < num_generators; ++i) {
|
||||||
if (arg == generators[i].generator_opt_long ||
|
if (arg == generators[i].generator_opt_long ||
|
||||||
|
|||||||
Reference in New Issue
Block a user