MCPcopy Create free account
hub / github.com/apache/fory / parse_args

Function parse_args

compiler/fory_compiler/cli.py:464–670  ·  view source on GitHub ↗

Parse command line arguments.

(args: Optional[List[str]] = None)

Source from the content-addressed store, hash-verified

462
463
464def parse_args(args: Optional[List[str]] = None) -> argparse.Namespace:
465 """Parse command line arguments."""
466 parser = argparse.ArgumentParser(
467 prog="foryc",
468 description="Fory IDL compiler",
469 )
470
471 parser.add_argument(
472 "--scan-generated",
473 action="store_true",
474 help="Scan for generated files under the current directory",
475 )
476
477 parser.add_argument(
478 "files",
479 nargs="*",
480 type=Path,
481 metavar="FILE",
482 help="IDL files to compile",
483 )
484
485 parser.add_argument(
486 "--lang",
487 type=str,
488 default="all",
489 help="Comma-separated list of target languages (java,python,cpp,rust,go,csharp,javascript,swift,dart,scala,kotlin). Default: all",
490 )
491
492 parser.add_argument(
493 "--output",
494 "-o",
495 type=Path,
496 default=Path("./generated"),
497 help="Output directory. Default: ./generated",
498 )
499
500 parser.add_argument(
501 "-I",
502 "--proto_path",
503 "--import_path",
504 dest="import_paths",
505 action="append",
506 type=Path,
507 default=[],
508 metavar="PATH",
509 help="Add a directory to the import search path. Can be specified multiple times.",
510 )
511
512 # Language-specific output directories (protoc-style)
513 parser.add_argument(
514 "--java_out",
515 type=Path,
516 default=None,
517 metavar="DST_DIR",
518 help="Generate Java code in DST_DIR",
519 )
520
521 parser.add_argument(

Callers 4

mainFunction · 0.70

Calls

no outgoing calls