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

21 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

4items_app = typer.Typer() 1abcdefgh

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

6users_app = typer.Typer() 1abcdefgh

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

8 

9 

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

11def items_create(item: str): 1abcdefgh

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

13 

14 

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

16def items_delete(item: str): 1abcdefgh

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

18 

19 

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

21def items_sell(item: str): 1abcdefgh

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

23 

24 

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

26def users_create(user_name: str): 1abcdefgh

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

28 

29 

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

31def users_delete(user_name: str): 1abcdefgh

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

33 

34 

35if __name__ == "__main__": 1abcdefgh

36 app() 1abcdefgh