MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / parse_args

Function parse_args

scripts/prepare_release.py:383–429  ·  view source on GitHub ↗

Parse command-line arguments. Args: argv: Raw command-line arguments excluding the executable name. Returns: Parsed CLI arguments. Raises: ReleaseError: Push is requested without commit.

(argv: list[str])

Source from the content-addressed store, hash-verified

381
382
383def parse_args(argv: list[str]) -> argparse.Namespace:
384 """Parse command-line arguments.
385
386 Args:
387 argv: Raw command-line arguments excluding the executable name.
388
389 Returns:
390 Parsed CLI arguments.
391
392 Raises:
393 ReleaseError: Push is requested without commit.
394 """
395 parser = argparse.ArgumentParser(
396 description="Prepare an AstrBot release branch, version bump, and changelog.",
397 )
398 parser.add_argument("version", help="Release version without the leading v")
399 parser.add_argument("--base-branch", default="master", help="Release base branch")
400 parser.add_argument("--remote", default="origin", help="Git remote name")
401 parser.add_argument(
402 "--generate-api-client",
403 action="store_true",
404 help="Run dashboard API client generation before validation",
405 )
406 parser.add_argument(
407 "--dashboard-build",
408 action="store_true",
409 help="Run dashboard install and build validation",
410 )
411 parser.add_argument(
412 "--skip-checks",
413 action="store_true",
414 help="Skip ruff format and ruff check",
415 )
416 parser.add_argument(
417 "--commit",
418 action="store_true",
419 help="Commit the generated release preparation changes",
420 )
421 parser.add_argument(
422 "--push",
423 action="store_true",
424 help="Push the release branch after committing; requires --commit",
425 )
426 args = parser.parse_args(argv)
427 if args.push and not args.commit:
428 raise ReleaseError("--push requires --commit")
429 return args
430
431
432def main(argv: list[str] | None = None) -> int:

Callers 1

mainFunction · 0.70

Calls 1

ReleaseErrorClass · 0.85

Tested by

no test coverage detected