Skip to content

API Reference

copier_astral_example

A Python project generated by using https://github.com/ritwiktiwari/copier-astral.

CLI Module

copier_astral_example.cli

Command-line interface for copier_astral_example.

hello(name=typer.Argument('World', help='Name to greet'))

Say hello to someone.

Source code in src/copier_astral_example/cli.py
@app.command()
def hello(
    name: str = typer.Argument("World", help="Name to greet"),
) -> None:
    """Say hello to someone."""
    typer.echo(f"Hello, {name}!")

main(version=typer.Option(None, '--version', '-v', help='Show version and exit.', callback=version_callback, is_eager=True))

A Python project generated by using https://github.com/ritwiktiwari/copier-astral.

Source code in src/copier_astral_example/cli.py
@app.callback()
def main(
    version: bool | None = typer.Option(
        None,
        "--version",
        "-v",
        help="Show version and exit.",
        callback=version_callback,
        is_eager=True,
    ),
) -> None:
    """A Python project generated by using https://github.com/ritwiktiwari/copier-astral."""

version_callback(value)

Print version and exit.

Source code in src/copier_astral_example/cli.py
def version_callback(value: bool) -> None:
    """Print version and exit."""
    if value:
        typer.echo(f"copier_astral_example version: {__version__}")
        raise typer.Exit()