"""Entrypoint for the report generator CLI.""" from cc_common.api.cli import CLIManager from cc_common.config import load_environment from persistent_storage.shared import inject_secrets from .commands.generate import FolderProperties, GenerateProperties, from_folder, generate def run() -> None: """Entrypoint for CLI.""" load_environment() cli = CLIManager("report_generator", "Generates the PDF report of a scan.") cli.register_command( "generate", _with_storage_secrets, GenerateProperties, help="Builds the report of a scan held in the store.", ) cli.register_command( "from-folder", from_folder, FolderProperties, help="Builds the report from a folder of exported artifacts, without Postgres or the bucket.", ) cli.run() def _with_storage_secrets(properties: GenerateProperties) -> object: """Fill the storage configuration's secrets from the environment before the command runs.""" inject_secrets(properties.storage_config) return generate(properties) if __name__ == "__main__": run()