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

fix(cli): enhance output format handling in query command

* Update output format option help text to specify valid formats (table, json, yaml).
* Implement error handling for invalid output format values in query_tdocs function.
parent 0bf1c866
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ OverallTimeoutOption = Annotated[
    int | None,
    typer.Option("--overall-timeout", help="Maximum total crawl duration in seconds (None = unlimited)", envvar="TDC_OVERALL_TIMEOUT"),
]
OutputFormatOption = Annotated[str, typer.Option("--output", "-o", help="Output format", envvar="TDC_OUTPUT")]
OutputFormatOption = Annotated[str, typer.Option("--output", "-o", help="Output format (table, json, yaml)", envvar="TDC_OUTPUT")]
EolUsernameOption = Annotated[str | None, typer.Option("--eol-username", help="ETSI Online account username", envvar="TDC_EOL_USERNAME")]
EolPasswordOption = Annotated[str | None, typer.Option("--eol-password", help="ETSI Online account password", envvar="TDC_EOL_PASSWORD")]
PromptCredentialsOption = Annotated[
+7 −1
Original line number Diff line number Diff line
@@ -96,9 +96,15 @@ def query_tdocs(
        console.print("[red]Invalid order value; use asc or desc")
        raise typer.Exit(code=2) from exc

    try:
        format_val = OutputFormat(output_format.lower())
    except ValueError as exc:
        console.print("[red]Invalid output format; use table, json, or yaml")
        raise typer.Exit(code=2) from exc

    config = TDocQueryConfig(
        cache_dir=manager.root,
        output_format=output_format,
        output_format=format_val,
        tdoc_ids=tdoc_ids,
        working_groups=working_groups,
        start_date=start,