Make argument parser.
()
| 464 | |
| 465 | |
| 466 | def make_parser(): |
| 467 | """Make argument parser.""" |
| 468 | |
| 469 | parser = argparse.ArgumentParser() |
| 470 | subparsers = parser.add_subparsers(dest="cmd", help="Available subcommands") |
| 471 | |
| 472 | p_codegen = subparsers.add_parser("codegen", help="generate code") |
| 473 | p_codegen.add_argument( |
| 474 | "--noformat", action="store_true", help="prevent reformatting" |
| 475 | ) |
| 476 | |
| 477 | subparsers.add_parser("lint", help="lint code") |
| 478 | |
| 479 | subparsers.add_parser("format", help="reformat code") |
| 480 | |
| 481 | p_update_dev = subparsers.add_parser( |
| 482 | "updateplotlyjsdev", help="update plotly.js for development" |
| 483 | ) |
| 484 | p_update_dev.add_argument( |
| 485 | "--devrepo", default="plotly/plotly.js", help="repository" |
| 486 | ) |
| 487 | p_update_dev.add_argument("--devbranch", default="master", help="branch") |
| 488 | p_update_dev.add_argument("--local", default=None, help="local path") |
| 489 | |
| 490 | subparsers.add_parser("updateplotlyjs", help="update plotly.js") |
| 491 | |
| 492 | p_bump_version = subparsers.add_parser("bumpversion", help="bump plotly.py version") |
| 493 | # Add a positional argument for the version |
| 494 | p_bump_version.add_argument("version", help="version number") |
| 495 | |
| 496 | return parser |
| 497 | |
| 498 | |
| 499 | def parse_args(parser: argparse.ArgumentParser): |