Coverage for docs_src / first_steps / tutorial006.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1import typer 1abcdefghij

2 

3 

4def main(name: str, lastname: str = "", formal: bool = False): 1abcdefghij

5 """ 

6 Say hi to 'name', optionally with a --lastname. 

7 

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

9 """ 

10 if formal: 1abcdefghij

11 print(f"Good day Ms. {name} {lastname}.") 1abcdefghij

12 else: 

13 print(f"Hello {name} {lastname}") 1abcdefghij

14 

15 

16if __name__ == "__main__": 1abcdefghij

17 typer.run(main) 1abcdefghij