34 lines
903 B
Python
34 lines
903 B
Python
"""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 GenerateProperties, generate
|
|
|
|
|
|
def run() -> None:
|
|
"""Entrypoint for CLI."""
|
|
load_environment()
|
|
|
|
cli = CLIManager("report_generator", "Generates the PDF report of a stored scan.")
|
|
|
|
cli.register_command(
|
|
"generate",
|
|
_with_storage_secrets,
|
|
GenerateProperties,
|
|
help="Builds the PDF report of one scan from the artifacts it stored.",
|
|
)
|
|
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()
|