From 2bc0013d8b2e79e0bc207bfd78935f0ff4602c96 Mon Sep 17 00:00:00 2001 From: Dane Hillard Date: Sat, 16 Nov 2024 17:01:29 -0500 Subject: [PATCH] Add Typer example Resolves #94 --- examples/typer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/typer.py diff --git a/examples/typer.py b/examples/typer.py new file mode 100644 index 0000000..ad4d883 --- /dev/null +++ b/examples/typer.py @@ -0,0 +1,19 @@ +from typing import Annotated + +import typer +from trogon.typer import init_tui + + +app = typer.Typer() + + +@app.command() +def hello(name: Annotated[str, typer.Argument(help="The person to greet")]): + typer.echo(f"Hello, {name}!") + + +init_tui(app) + + +if __name__ == "__main__": + app()