| 452 | |
| 453 | |
| 454 | def build_parser() -> argparse.ArgumentParser: |
| 455 | parser = argparse.ArgumentParser( |
| 456 | description="Check changed Markdown articles for content depth and image health.", |
| 457 | ) |
| 458 | parser.add_argument("paths", nargs="*", help="Specific files to check.") |
| 459 | parser.add_argument("--all", action="store_true", help="Check every article file.") |
| 460 | parser.add_argument("--staged", action="store_true", help="Check staged article files.") |
| 461 | parser.add_argument("--base", help="Base git revision for changed-file checks.") |
| 462 | parser.add_argument("--head", default="HEAD", help="Head git revision for changed-file checks.") |
| 463 | parser.add_argument("--min-chars", type=int, default=DEFAULT_MIN_CHARS) |
| 464 | parser.add_argument("--min-paragraphs", type=int, default=DEFAULT_MIN_PARAGRAPHS) |
| 465 | parser.add_argument("--min-sentences", type=int, default=DEFAULT_MIN_SENTENCES) |
| 466 | parser.add_argument("--max-broken-images", type=int, default=DEFAULT_MAX_BROKEN_IMAGES) |
| 467 | parser.add_argument( |
| 468 | "--check-remote-images", |
| 469 | dest="check_remote_images", |
| 470 | action="store_true", |
| 471 | default=DEFAULT_CHECK_REMOTE_IMAGES, |
| 472 | help="Validate remote image URLs with HTTP requests.", |
| 473 | ) |
| 474 | parser.add_argument( |
| 475 | "--skip-remote-images", |
| 476 | dest="check_remote_images", |
| 477 | action="store_false", |
| 478 | help="Skip HTTP checks for remote image URLs.", |
| 479 | ) |
| 480 | parser.add_argument("--remote-image-timeout", type=float, default=DEFAULT_REMOTE_IMAGE_TIMEOUT) |
| 481 | parser.add_argument("--max-image-errors", type=int, default=DEFAULT_MAX_IMAGE_ERRORS) |
| 482 | return parser |
| 483 | |
| 484 | |
| 485 | def main() -> int: |