Coverage for docs_src/subcommands/name_help/tutorial004.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-04-14 00:18 +0000

1import typer 1iabcdefgh

2 

3app = typer.Typer() 1iabcdefgh

4 

5 

6def old_callback(): 1iabcdefgh

7 """ 

8 Old callback help. 

9 """ 

10 

11 

12users_app = typer.Typer(callback=old_callback) 1iabcdefgh

13app.add_typer(users_app, name="users") 1iabcdefgh

14 

15 

16@users_app.callback() 1iabcdefgh

17def users(): 1abcdefgh

18 """ 

19 Manage users in the app. 

20 """ 

21 

22 

23@users_app.command() 1iabcdefgh

24def create(name: str): 1iabcdefgh

25 print(f"Creating user: {name}") 1iabcdefgh

26 

27 

28if __name__ == "__main__": 1iabcdefgh

29 app() 1iabcdefgh