Coverage for docs_src / commands / callback / tutorial004.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1import typer 1abcdefghij

2 

3app = typer.Typer() 1abcdefghij

4 

5 

6@app.callback() 1abcdefghij

7def callback(): 1abcdefghij

8 """ 

9 Manage users CLI app. 

10 

11 Use it with the create command. 

12 

13 A new user with the given NAME will be created. 

14 """ 

15 

16 

17@app.command() 1abcdefghij

18def create(name: str): 1abcdefghij

19 print(f"Creating user: {name}") 1abcdefghij

20 

21 

22if __name__ == "__main__": 1abcdefghij

23 app() 1abcdefghij