Skip to content

Config

config

CLI for configuration management

app = typer.Typer() module-attribute

main(ctx: typer.Context)

Manage app configuration.

Source code in src/python_cli_app_template/cli/config.py
@app.callback()
def main(ctx: typer.Context):
    """Manage app configuration."""
    logging.getLogger(__name__).debug(f'About to execute command: {ctx.command.name}/{ctx.invoked_subcommand}')

show(show_origin: Annotated[bool, typer.Option(--show - origin, help='Show origin of each configuration item.')] = False)

Show all configuration items.

Source code in src/python_cli_app_template/cli/config.py
@app.command()
def show(
    show_origin: Annotated[  # noqa: FBT002
        bool, typer.Option('--show-origin', help='Show origin of each configuration item.')
    ] = False,
):
    """Show all configuration items."""
    if show_origin:
        typer.echo(config.settings_history())
    else:
        typer.echo(config.settings_as_str())