Commit 5cd33bef authored by Jan Reimes's avatar Jan Reimes
Browse files

feat(cli): add no-progress option to disable progress bar during crawl

* Introduced NoProgressOption to allow users to disable the progress bar.
* Updated crawl_tdocs function to handle no progress scenario.
* Adjusted progress handling logic based on the no_progress flag.
parent f95f9d2f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -23,9 +23,11 @@ SubgroupOption = Annotated[
    typer.Option("--sub-group", "-s", help="Filter by sub-working group (e.g., 'R2-102')", envvar="TDC_SUB_GROUP"),
]
LimitMeetingsOption = Annotated[int | None, typer.Option("--limit-meetings", help="Limit meetings overall", envvar="TDC_LIMIT_MEETINGS")]
# TODO: This parameter does not make sense for working groups, but would for sub-workinggroups. Consider renaming to --limit-meetings-per-swg.
LimitMeetingsPerWgOption = Annotated[
    int | None, typer.Option("--limit-meetings-per-wg", help="Limit meetings per working group", envvar="TDC_LIMIT_MEETINGS_PER_WG")
]
# TODO: This parameter does not make sense for working groups, but would for sub-workinggroups.
LimitWgsOption = Annotated[int | None, typer.Option("--limit-wgs", help="Limit number of working groups")]
LimitOption = Annotated[int | None, typer.Option("--limit", "-l", help="Maximum number of rows")]
OrderOption = Annotated[str, typer.Option("--order", help="Sort order (asc|desc)")]
@@ -118,3 +120,8 @@ HttpCacheOption = Annotated[
        envvar="HTTP_CACHE_ENABLED",
    ),
]

NoProgressOption = Annotated[
    bool,
    typer.Option("--no-progress", help="Disable progress bar (useful for scripts and CI)"),
]
+11 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ from tdoc_crawler.cli.args import (
    LimitTDocsOption,
    LimitWgsOption,
    MaxRetriesOption,
    NoProgressOption,
    OutputFormatOption,
    OverallTimeoutOption,
    PromptCredentialsOption,
@@ -76,6 +77,7 @@ def crawl_tdocs(
    timeout: TimeoutOption = 30,
    max_retries: MaxRetriesOption = 3,
    overall_timeout: OverallTimeoutOption = None,
    no_progress: NoProgressOption = False,
    cache_dir: CacheDirOption = None,
    http_cache_enabled: HttpCacheOption = None,
    verbosity: VerbosityOption = str(DEFAULT_VERBOSITY),
@@ -133,6 +135,10 @@ def crawl_tdocs(

        crawl_start_time = datetime.now()

        if no_progress:
            # No progress bar - just run the crawl
            result = crawler.crawl(config, progress_callback=None)
        else:
            progress, task = create_progress_bar("[cyan]Crawling TDocs...")

            with progress: