Coverage for docs_src/options/help/tutorial001.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(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: 1iabcdefgh

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

16 else: 

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

18 

19 

20if __name__ == "__main__": 1iabcdefgh

21 typer.run(main) 1iabcdefgh