Coverage for docs_src/subcommands/name_help/tutorial005.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 18:26 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 18:26 +0000
1import typer 1habcdefg
3app = typer.Typer() 1habcdefg
6def old_callback(): 1habcdefg
7 """
8 Old callback help.
9 """
12users_app = typer.Typer(callback=old_callback) 1habcdefg
15def new_users(): 1habcdefg
16 """
17 I have the highland! Create some users.
18 """
21app.add_typer(users_app, callback=new_users) 1habcdefg
24@users_app.callback() 1habcdefg
25def users(): 1abcdefg
26 """
27 Manage users in the app.
28 """
31@users_app.command() 1habcdefg
32def create(name: str): 1habcdefg
33 print(f"Creating user: {name}") 1habcdefg
36if __name__ == "__main__": 1habcdefg
37 app() 1habcdefg