Coverage for docs_src/subcommands/callback_override/tutorial002.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import typer 1abcdefgh

2 

3app = typer.Typer() 1abcdefgh

4 

5 

6def users_callback(): 1abcdefgh

7 print("Running a users command") 1abcdefgh

8 

9 

10users_app = typer.Typer(callback=users_callback) 1abcdefgh

11app.add_typer(users_app, name="users") 1abcdefgh

12 

13 

14@users_app.command() 1abcdefgh

15def create(name: str): 1abcdefgh

16 print(f"Creating user: {name}") 1abcdefgh

17 

18 

19if __name__ == "__main__": 1abcdefgh

20 app() 1abcdefgh