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

5 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import typer 1habcdefg

2 

3 

4def main( 1abcdefg

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: 1habcdefg

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

21 else: 

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

23 

24 

25if __name__ == "__main__": 1habcdefg

26 typer.run(main) 1habcdefg