Extract options from manpages and store in DB.
(
ctx: click.Context,
mode: str,
files: tuple[str, ...],
dry_run: bool,
overwrite: bool,
filter_db: tuple[str, ...],
drop: bool,
jobs: int,
batch: int | None,
debug: bool,
small_only: bool,
large_only: bool,
reason: str | None,
)
| 583 | @click.argument("files", nargs=-1, required=True) |
| 584 | @click.pass_context |
| 585 | def extract( |
| 586 | ctx: click.Context, |
| 587 | mode: str, |
| 588 | files: tuple[str, ...], |
| 589 | dry_run: bool, |
| 590 | overwrite: bool, |
| 591 | filter_db: tuple[str, ...], |
| 592 | drop: bool, |
| 593 | jobs: int, |
| 594 | batch: int | None, |
| 595 | debug: bool, |
| 596 | small_only: bool, |
| 597 | large_only: bool, |
| 598 | reason: str | None, |
| 599 | ) -> None: |
| 600 | """Extract options from manpages and store in DB.""" |
| 601 | try: |
| 602 | parsed_mode, model = _parse_mode(mode) |
| 603 | except ValueError as e: |
| 604 | raise click.UsageError(str(e)) |
| 605 | |
| 606 | if jobs < 1: |
| 607 | raise click.UsageError("--jobs must be >= 1") |
| 608 | if small_only and large_only: |
| 609 | raise click.UsageError("--small-only and --large-only are mutually exclusive") |
| 610 | if drop and dry_run: |
| 611 | raise click.UsageError("--drop and --dry-run are mutually exclusive") |
| 612 | |
| 613 | filter_specs: list[tuple[str, str | None]] = [] |
| 614 | if filter_db: |
| 615 | if not overwrite: |
| 616 | raise click.UsageError("--filter-db requires --overwrite") |
| 617 | for spec in filter_db: |
| 618 | try: |
| 619 | filter_specs.append(_parse_mode(spec)) |
| 620 | except ValueError as e: |
| 621 | raise click.UsageError(f"--filter-db: {e}") |
| 622 | |
| 623 | if batch is not None: |
| 624 | if batch < 1: |
| 625 | raise click.UsageError("--batch must be >= 1") |
| 626 | if not model: |
| 627 | raise click.UsageError( |
| 628 | "--batch requires a model (e.g. llm:gemini/<model>, llm:openai/<model>, or llm:azure/<deployment>)" |
| 629 | ) |
| 630 | if not model.startswith(_BATCH_MODEL_PREFIXES): |
| 631 | raise click.UsageError( |
| 632 | "--batch only supports gemini/, openai/, and azure/ models" |
| 633 | ) |
| 634 | |
| 635 | try: |
| 636 | gz_files = util.collect_gz_files(list(files)) |
| 637 | except ValueError as e: |
| 638 | raise click.UsageError(str(e)) |
| 639 | if not gz_files: |
| 640 | raise click.UsageError("No .gz files found.") |
| 641 | if not dry_run and len(gz_files) > 100 and not reason: |
| 642 | raise click.UsageError( |
nothing calls this directly
no test coverage detected