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

10 statements  

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

1import typer 1habcdefg

2 

3app = typer.Typer() 1habcdefg

4 

5users_app = typer.Typer() 1habcdefg

6app.add_typer(users_app, name="users") 1habcdefg

7 

8 

9@users_app.callback() 1habcdefg

10def users_callback(): 1abcdefg

11 print("Running a users command") 1habcdefg

12 

13 

14@users_app.command() 1habcdefg

15def create(name: str): 1habcdefg

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

17 

18 

19if __name__ == "__main__": 1habcdefg

20 app() 1habcdefg