docbuild.cli.cmd_cli#

Main CLI tool for document operations.

Functions#

handle_validation_error(→ None)

Format validation errors and exit the CLI.

cli(→ None)

Acts as a main entry point for CLI tool.

Module Contents#

docbuild.cli.cmd_cli.handle_validation_error(e: Exception, model_class: type[pydantic.BaseModel], config_files: collections.abc.Sequence[pathlib.Path] | None, verbose: int, ctx: click.Context) None#

Format validation errors and exit the CLI.

Outsourced logic to avoid code duplication between App and Env config phases. Using Sequence[Path] ensures compatibility with both lists and tuples. :param e: The exception that was raised during validation. :param model_class: The Pydantic model class that was being validated

(AppConfig or EnvConfig).

Parameters:
  • config_files – The list of config files that were attempted to be loaded, used for error context.

  • verbose – The verbosity level from the CLI options, which can be used to control the level of detail in the error output.

  • ctx – The Click context, used to exit the CLI with an appropriate status code after handling the error.

docbuild.cli.cmd_cli.cli(ctx: click.Context, verbose: int, dry_run: bool, debug: bool, app_config: pathlib.Path, env_config: pathlib.Path, **kwargs: dict) None#

Acts as a main entry point for CLI tool.

Parameters:
  • ctx – The Click context object.

  • verbose – The verbosity level.

  • dry_run – If set, just pretend to run the command without making any changes.

  • debug – If set, enable debug mode.

  • app_config – Filename to the application TOML config file.

  • env_config – Filename to a environment’s TOML config file.

  • kwargs – Additional keyword arguments.