Skip to content

cli

Typer-based CLI demonstration module.

Functions:

  • main

    Demonstration CLI entrypoint using Typer.

main

main(foo: str, bar: list[str], src: Path) -> None

Demonstration CLI entrypoint using Typer.

See https://typer.tiangolo.com/.

Source code in src/jambazid/demo/cli.py
@app.command()
def main(
    foo: typing.Annotated[
        str,
        typer.Option(help="Demonstration Option #1."),
    ],
    bar: typing.Annotated[
        list[str],
        typer.Option(help="Demonstration Option #2.", default_factory=list[str]),
    ],
    src: typing.Annotated[
        pathlib.Path,
        typer.Option(help="Demonstration Option #3."),
    ],
) -> None:
    """
    Demonstration CLI entrypoint using Typer.

    See <https://typer.tiangolo.com/>.
    """
    print("foo:", foo)

    for idx, value in enumerate(bar):
        print(f"bar[{idx}]:", value)

    print("src:", src.as_posix())