Coverage for docs_src/options/help/tutorial002.py: 100%

5 statements  

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

1import typer 1iabcdefgh

2 

3 

4def main( 1abcdefgh

5 name: str, 

6 lastname: str = typer.Option("", help="Last name of person to greet."), 

7 formal: bool = typer.Option( 

8 False, help="Say hi formally.", rich_help_panel="Customization and Utils" 

9 ), 

10 debug: bool = typer.Option( 

11 False, help="Enable debugging.", rich_help_panel="Customization and Utils" 

12 ), 

13): 

14 """ 

15 Say hi to NAME, optionally with a --lastname. 

16 

17 If --formal is used, say hi very formally. 

18 """ 

19 if formal: 1iabcdefgh

20 print(f"Good day Ms. {name} {lastname}.") 1iabcdefgh

21 else: 

22 print(f"Hello {name} {lastname}") 1iabcdefgh

23 

24 

25if __name__ == "__main__": 1iabcdefgh

26 typer.run(main) 1iabcdefgh