add command line argument for go namespace (#4222)

This commit is contained in:
Flier Lu
2017-03-21 07:08:35 +08:00
committed by Wouter van Oortmerssen
parent f2071e4f80
commit b8f5f84437
3 changed files with 21 additions and 6 deletions

View File

@@ -90,6 +90,7 @@ std::string FlatCompiler::GetUsageString(const char* program_name) const {
" T::c_str() and T::length() must be supported\n"
" --no-js-exports Removes Node.js style export lines in JS.\n"
" --goog-js-export Uses goog.exports* for closure compiler exporting in JS.\n"
" --go-namespace Generate the overrided namespace in Golang.\n"
" --raw-binary Allow binaries without file_indentifier to be read.\n"
" This may crash flatc given a mismatched schema.\n"
" --proto Input is a .proto, translate to .fbs.\n"
@@ -160,6 +161,9 @@ int FlatCompiler::Compile(int argc, const char** argv) {
opts.skip_js_exports = true;
} else if(arg == "--goog-js-export") {
opts.use_goog_js_export_format = true;
} else if(arg == "--go-namespace") {
if (++argi >= argc) Error("missing golang namespace" + arg, true);
opts.go_namespace = argv[argi];
} else if(arg == "--defaults-json") {
opts.output_default_scalars_in_json = true;
} else if (arg == "--unknown-json") {