| Conditions | 1 |
| Total Lines | 36 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import argparse |
||
| 16 | def make_parser() -> argparse.Namespace: |
||
| 17 | parser = argparse.ArgumentParser( |
||
| 18 | description="run a verboselib command", |
||
| 19 | add_help=True, |
||
| 20 | ) |
||
| 21 | parser.add_argument( |
||
| 22 | "-V", "--version", |
||
| 23 | dest="show_version", |
||
| 24 | action="store_true", |
||
| 25 | help="show version of verboselib and exit" |
||
| 26 | ) |
||
| 27 | |||
| 28 | subparsers = parser.add_subparsers( |
||
| 29 | title="subcommands", |
||
| 30 | dest="command_name", |
||
| 31 | ) |
||
| 32 | |||
| 33 | extract_cmd_parser = ExtractCommand.make_parser( |
||
| 34 | factory=functools.partial( |
||
| 35 | subparsers.add_parser, |
||
| 36 | name=ExtractCommand.name, |
||
| 37 | aliases=ExtractCommand.aliases, |
||
| 38 | ), |
||
| 39 | ) |
||
| 40 | extract_cmd_parser.set_defaults(executor_factory=ExtractCommand.make_executor) |
||
| 41 | |||
| 42 | compile_cmd_parser = CompileCommand.make_parser( |
||
| 43 | factory=functools.partial( |
||
| 44 | subparsers.add_parser, |
||
| 45 | name=CompileCommand.name, |
||
| 46 | aliases=CompileCommand.aliases, |
||
| 47 | ), |
||
| 48 | ) |
||
| 49 | compile_cmd_parser.set_defaults(executor_factory=CompileCommand.make_executor) |
||
| 50 | |||
| 51 | return parser |
||
| 52 | |||
| 67 |