MCPcopy Create free account
hub / github.com/catboost/catboost / ParseFromCommandLineArguments

Method ParseFromCommandLineArguments

contrib/libs/flatbuffers/src/flatc.cpp:422–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
423 const char **argv) {
424 if (argc <= 1) { Error("Need to provide at least one argument."); }
425
426 FlatCOptions options;
427
428 options.program_name = std::string(argv[0]);
429
430 IDLOptions &opts = options.opts;
431
432 for (int argi = 1; argi < argc; argi++) {
433 std::string arg = argv[argi];
434 if (arg[0] == '-') {
435 if (options.filenames.size() && arg[1] != '-')
436 Error("invalid option location: " + arg, true);
437 if (arg == "-o") {
438 if (++argi >= argc) Error("missing path following: " + arg, true);
439 options.output_path = flatbuffers::ConCatPathFileName(
440 flatbuffers::PosixPath(argv[argi]), "");
441 } else if (arg == "-I") {
442 if (++argi >= argc) Error("missing path following: " + arg, true);
443 options.include_directories_storage.push_back(
444 flatbuffers::PosixPath(argv[argi]));
445 options.include_directories.push_back(
446 options.include_directories_storage.back().c_str());
447 } else if (arg == "--bfbs-filenames") {
448 if (++argi > argc) Error("missing path following: " + arg, true);
449 opts.project_root = argv[argi];
450 if (!DirExists(opts.project_root.c_str()))
451 Error(arg + " is not a directory: " + opts.project_root);
452 } else if (arg == "--conform") {
453 if (++argi >= argc) Error("missing path following: " + arg, true);
454 options.conform_to_schema = flatbuffers::PosixPath(argv[argi]);
455 } else if (arg == "--conform-includes") {
456 if (++argi >= argc) Error("missing path following: " + arg, true);
457 options.include_directories_storage.push_back(
458 flatbuffers::PosixPath(argv[argi]));
459 options.conform_include_directories.push_back(
460 options.include_directories_storage.back().c_str());
461 } else if (arg == "--include-prefix") {
462 if (++argi >= argc) Error("missing path following: " + arg, true);
463 opts.include_prefix = flatbuffers::ConCatPathFileName(
464 flatbuffers::PosixPath(argv[argi]), "");
465 } else if (arg == "--keep-prefix") {
466 opts.keep_prefix = true;
467 } else if (arg == "--strict-json") {
468 opts.strict_json = true;
469 } else if (arg == "--allow-non-utf8") {
470 opts.allow_non_utf8 = true;
471 } else if (arg == "--natural-utf8") {
472 opts.natural_utf8 = true;
473 } else if (arg == "--go-namespace") {
474 if (++argi >= argc) Error("missing golang namespace" + arg, true);
475 opts.go_namespace = argv[argi];
476 } else if (arg == "--go-import") {
477 if (++argi >= argc) Error("missing golang import" + arg, true);
478 opts.go_import = argv[argi];
479 } else if (arg == "--go-module-name") {

Callers 1

mainFunction · 0.80

Calls 15

ConCatPathFileNameFunction · 0.85
PosixPathFunction · 0.85
DirExistsFunction · 0.85
strcmpFunction · 0.85
WarnFunction · 0.85
FLATC_VERSIONFunction · 0.85
exitFunction · 0.85
ErrorFunction · 0.70
stringClass · 0.50
moveFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected