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

21 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

4items_app = typer.Typer() 1abcdefghij

5app.add_typer(items_app, name="items") 1abcdefghij

6users_app = typer.Typer() 1abcdefghij

7app.add_typer(users_app, name="users") 1abcdefghij

8 

9 

10@items_app.command("create") 1abcdefghij

11def items_create(item: str): 1abcdefghij

12 print(f"Creating item: {item}") 1abcdefghij

13 

14 

15@items_app.command("delete") 1abcdefghij

16def items_delete(item: str): 1abcdefghij

17 print(f"Deleting item: {item}") 1abcdefghij

18 

19 

20@items_app.command("sell") 1abcdefghij

21def items_sell(item: str): 1abcdefghij

22 print(f"Selling item: {item}") 1abcdefghij

23 

24 

25@users_app.command("create") 1abcdefghij

26def users_create(user_name: str): 1abcdefghij

27 print(f"Creating user: {user_name}") 1abcdefghij

28 

29 

30@users_app.command("delete") 1abcdefghij

31def users_delete(user_name: str): 1abcdefghij

32 print(f"Deleting user: {user_name}") 1abcdefghij

33 

34 

35if __name__ == "__main__": 1abcdefghij

36 app() 1abcdefghij