Coverage for docs_src/commands/help/tutorial006.py: 100%

20 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1import typer 1abcdefghi

2 

3app = typer.Typer(rich_markup_mode="rich") 1abcdefghi

4 

5 

6@app.command() 1abcdefghi

7def create(username: str): 1abcdefghi

8 """ 

9 [green]Create[/green] a new user. :sparkles: 

10 """ 

11 print(f"Creating user: {username}") 1abcdefghi

12 

13 

14@app.command() 1abcdefghi

15def delete(username: str): 1abcdefghi

16 """ 

17 [red]Delete[/red] a user. :x: 

18 """ 

19 print(f"Deleting user: {username}") 1abcdefghi

20 

21 

22@app.command(rich_help_panel="Utils and Configs") 1abcdefghi

23def config(configuration: str): 1abcdefghi

24 """ 

25 [blue]Configure[/blue] the system. :gear: 

26 """ 

27 print(f"Configuring the system with: {configuration}") 1abcdefghi

28 

29 

30@app.command(rich_help_panel="Utils and Configs") 1abcdefghi

31def sync(): 1abcdefghi

32 """ 

33 [blue]Synchronize[/blue] the system or something fancy like that. :recycle: 

34 """ 

35 print("Syncing the system") 1abcdefghi

36 

37 

38@app.command(rich_help_panel="Help and Others") 1abcdefghi

39def help(): 1abcdefghi

40 """ 

41 Get [yellow]help[/yellow] with the system. :question: 

42 """ 

43 print("Opening help portal...") 1abcdefghi

44 

45 

46@app.command(rich_help_panel="Help and Others") 1abcdefghi

47def report(): 1abcdefghi

48 """ 

49 [yellow]Report[/yellow] an issue. :exclamation: 

50 """ 

51 print("Please open a new issue online, not a direct message") 1abcdefghi

52 

53 

54if __name__ == "__main__": 1abcdefghi

55 app() 1abcdefghi