(argv: list[str])
| 15 | |
| 16 | |
| 17 | def _parse(argv: list[str]) -> argparse_flags.argparse.Namespace: |
| 18 | kwargs = dict(inherited_absl_flags=FlagValues()) |
| 19 | root = CommandGroup("root", argv=argv, **kwargs) |
| 20 | root.add_flag("--root", undefok=True, action="store_true") |
| 21 | root.add_flag("--root_default", undefok=True, default="some_value") |
| 22 | |
| 23 | child1 = CommandGroup("child1", parent=root, **kwargs) |
| 24 | child1.add_flag("--child1", undefok=True, action="store_true") |
| 25 | grandchild1 = CommandGroup("grandchild1", parent=child1, **kwargs) |
| 26 | grandchild1.add_cmd_from_module("command1", module="axlearn.cli.testdata.dummy", **kwargs) |
| 27 | grandchild1.add_cmd_from_module( |
| 28 | "command2", module="axlearn.cli.testdata.dummy", filter_argv="undefok|.*default", **kwargs |
| 29 | ) |
| 30 | |
| 31 | child2 = CommandGroup("child2", parent=root, **kwargs) |
| 32 | # All leaf commands must support --child2. |
| 33 | child2.add_flag("--child2", undefok=False, action="store_true", required=True) |
| 34 | child2.add_cmd_from_module("command2", module="axlearn.cli.testdata.dummy", **kwargs) |
| 35 | return root.parse_known_args() |
| 36 | |
| 37 | |
| 38 | def _run(args: argparse_flags.argparse.Namespace) -> tuple[int, str, str]: |
no test coverage detected