Coverage for docs_src/options/help/tutorial001.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(False, help="Say hi formally."), 

8): 

9 """ 

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

11 

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

13 """ 

14 if formal: 1habcdefg

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

16 else: 

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

18 

19 

20if __name__ == "__main__": 1habcdefg

21 typer.run(main) 1habcdefg