Knit CLI API together and produce an argparse based parser.
()
| 329 | |
| 330 | |
| 331 | def parser_factory(): |
| 332 | """Knit CLI API together and produce an argparse based parser.""" |
| 333 | p = argparse.ArgumentParser( |
| 334 | prog='openVulnQuery', |
| 335 | description='Cisco OpenVuln API Command Line Interface') |
| 336 | p.set_defaults(output_format=(constants.JSON_OUTPUT_FORMAT_TOKEN, None)) |
| 337 | |
| 338 | |
| 339 | add_options_to_parser( |
| 340 | p.add_mutually_exclusive_group(required=True), CLI_API_API_RESOURCE) |
| 341 | |
| 342 | add_options_to_parser( |
| 343 | p.add_mutually_exclusive_group(), CLI_API_OUTPUT_FORMAT) |
| 344 | |
| 345 | add_options_to_parser( |
| 346 | p.add_mutually_exclusive_group(), CLI_API_ADDITIONAL_FILTERS) |
| 347 | |
| 348 | add_options_to_parser(p, CLI_API_PARSER_GENERIC) |
| 349 | |
| 350 | add_options_to_parser( |
| 351 | p.add_mutually_exclusive_group(required=False), CLI_API_CONFIG) |
| 352 | |
| 353 | return p |
| 354 | |
| 355 | |
| 356 | def process_command_line(string_list=None): |
no test coverage detected