Commit fb03029a authored by Jan Reimes's avatar Jan Reimes
Browse files

feat(args): add SpecArgument for querying spec numbers

- Introduced SpecArgument to replace SpecOption for querying specs.
- Updated query_specs, crawl_specs, and checkout_spec functions to use SpecArgument.
parent 85cb2e63
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ from .args import (
    OverallTimeoutOption,
    PromptCredentialsOption,
    ReleaseOption,
    SpecArgument,
    SpecFileOption,
    SpecOption,
    StartDateOption,
@@ -406,7 +407,7 @@ def query_meetings(

@app.command("query-specs", rich_help_panel=HELP_PANEL_QUERY)
def query_specs(
    spec: SpecOption = None,
    spec_numbers: SpecArgument = None,
    spec_file: SpecFileOption = None,
    title: str = typer.Option(None, help="Filter by title contains"),
    working_group: WorkingGroupOption = None,
@@ -415,7 +416,7 @@ def query_specs(
    cache_dir: CacheDirOption = DEFAULT_CACHE_DIR,
) -> None:
    """Query spec metadata from database."""
    specs = collect_spec_numbers(spec, spec_file)
    specs = collect_spec_numbers(spec_numbers, spec_file)
    working_groups = parse_working_groups(working_group)
    wg_filter = working_groups[0].value if working_groups else None

@@ -571,14 +572,14 @@ def stats(

@app.command("crawl-specs", rich_help_panel=HELP_PANEL_CRAWLING)
def crawl_specs(
    spec: SpecOption = None,
    spec_numbers: SpecArgument = [],
    spec_file: SpecFileOption = None,
    release: ReleaseOption = "latest",
    output_format: OutputFormatOption = OutputFormat.TABLE.value,
    cache_dir: CacheDirOption = DEFAULT_CACHE_DIR,
) -> None:
    """Crawl spec metadata from configured sources."""
    specs = collect_spec_numbers(spec, spec_file)
    specs = collect_spec_numbers(spec_numbers, spec_file)
    try:
        output = OutputFormat(output_format.lower())
    except ValueError as exc:
@@ -609,7 +610,7 @@ def crawl_specs(

@app.command("checkout-spec", rich_help_panel=HELP_PANEL_QUERY)
def checkout_spec(
    spec: SpecOption = None,
    spec_numbers: SpecArgument = [],
    spec_file: SpecFileOption = None,
    release: ReleaseOption = "latest",
    doc_only: DocOnlyOption = False,
@@ -617,7 +618,7 @@ def checkout_spec(
    cache_dir: CacheDirOption = DEFAULT_CACHE_DIR,
) -> None:
    """Download and extract spec documents."""
    specs = collect_spec_numbers(spec, spec_file)
    specs = collect_spec_numbers(spec_numbers, spec_file)
    if not specs:
        console.print("[red]No specs provided[/red]")
        raise typer.Exit(code=1)
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ CheckoutTDocIdsArgument = Annotated[list[str], typer.Argument(help="TDoc identif
ForceOption = Annotated[bool, typer.Option("--force", "-f", help="Re-download even if already checked out")]

SpecOption = Annotated[list[str] | None, typer.Option("--spec", help="Spec number(s) (dotted or undotted)")]
SpecArgument = Annotated[list[str] | None, typer.Argument(help="Spec number(s) to query (dotted or undotted)")]
SpecFileOption = Annotated[Path | None, typer.Option("--spec-file", help="File with spec numbers")]
ReleaseOption = Annotated[str, typer.Option("--release", help="Spec release selector")]
DocOnlyOption = Annotated[bool, typer.Option("--doc-only/--no-doc-only", help="Attempt document-only download")]