Coverage for docs_src/using_click/tutorial003.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-19 20:29 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-19 20:29 +0000
1import click 1abcdefghi
2import typer 1abcdefghi
4app = typer.Typer() 1abcdefghi
7@app.command() 1abcdefghi
8def top(): 1abcdefghi
9 """
10 Top level command, form Typer
11 """
12 print("The Typer app is at the top level") 1abcdefghi
15@app.callback() 1abcdefghi
16def callback(): 1abcdefghi
17 """
18 Typer app, including Click subapp
19 """
22@click.command() 1abcdefghi
23@click.option("--name", prompt="Your name", help="The person to greet.") 1abcdefghi
24def hello(name): 1abcdefghi
25 """Simple program that greets NAME for a total of COUNT times."""
26 click.echo(f"Hello {name}!") 1abcdefghi
29typer_click_object = typer.main.get_command(app) 1abcdefghi
31typer_click_object.add_command(hello, "hello") 1abcdefghi
33if __name__ == "__main__": 1abcdefghi
34 typer_click_object() 1abcdefghi