Skip to content

Main

Tool to help manage using Nava PBC's platform work.

Source code in nava/platform/cli/main.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@app.callback()
def main(
    ctx: typer.Context,
    verbose: Annotated[
        int,
        typer.Option(
            "-v",
            "--verbose",
            count=True,
            help="Increase verbosity. Add enough -v's and you'll get the logs printed to your screen. Enjoy.",
        ),
    ] = 0,
    quiet: Annotated[
        bool, typer.Option("-q", "--quiet", help="Disable all console output")
    ] = False,
) -> None:
    """Tool to help manage using Nava PBC's platform work."""
    output_level = resolve_verbosity(verbose, quiet)
    log = nava.platform.cli.logging.initialize(output_level)
    console = nava.platform.cli.console.initialize(output_level)

    ctx.obj = CliContext(
        output_level=output_level,
        log=log.bind(),
        console=console,
        fail_with_usage=ctx.fail,
        exit=ctx.exit,
        exception_handler=exception_handler,
    )