MCPcopy Index your code
hub / github.com/idank/explainshell / build_parser

Function build_parser

tests/evals/render/render_eval.py:1381–1454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1379
1380
1381def build_parser() -> argparse.ArgumentParser:
1382 parser = argparse.ArgumentParser(description=__doc__)
1383 subparsers = parser.add_subparsers(dest="command", required=True)
1384
1385 render_p = subparsers.add_parser("render", help="render corpus artifacts")
1386 render_p.add_argument("paths", nargs="*", help="optional manpage paths")
1387 render_p.add_argument("--label", required=True, help="human-readable run label")
1388 render_p.add_argument(
1389 "--mandoc",
1390 help=f"mandoc binary (default: MANDOC_PATH/config, currently {config.MANDOC_PATH})",
1391 )
1392 render_p.add_argument(
1393 "--corpus", default=str(DEFAULT_CORPUS), help="corpus file path"
1394 )
1395 render_p.add_argument("--output", help="run output directory")
1396 render_p.add_argument(
1397 "--fail-on-failure",
1398 action="store_true",
1399 help="exit non-zero on render failures",
1400 )
1401 render_p.set_defaults(func=render_run)
1402
1403 compare_p = subparsers.add_parser("compare", help="compare two render runs")
1404 compare_p.add_argument("baseline", help="baseline run directory")
1405 compare_p.add_argument("current", help="current run directory")
1406 compare_p.add_argument(
1407 "--fail-on-suspicious",
1408 action="store_true",
1409 help="exit non-zero when suspicious structural changes are detected",
1410 )
1411 compare_p.set_defaults(func=compare_runs)
1412
1413 diff_p = subparsers.add_parser(
1414 "diff", help="build a Playwright-style screenshot diff report"
1415 )
1416 diff_p.add_argument("baseline", help="expected/baseline run directory")
1417 diff_p.add_argument("current", help="actual/current run directory")
1418 diff_p.add_argument("--output", help="diff report output directory")
1419 diff_p.add_argument(
1420 "--all",
1421 action="store_true",
1422 help="screenshot all pages instead of only suspicious pages",
1423 )
1424 diff_p.add_argument(
1425 "--limit", type=int, help="maximum number of pages to screenshot"
1426 )
1427 diff_p.add_argument(
1428 "--timeout",
1429 type=int,
1430 default=30_000,
1431 help="Playwright screenshot timeout in milliseconds",
1432 )
1433 diff_p.set_defaults(func=diff_report)
1434
1435 audit_p = subparsers.add_parser(
1436 "audit",
1437 help="audit a render run for absolute (baseline-free) rendering bugs",
1438 )

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected