Coverage for docs_src/options/name/tutorial005_an.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1import typer 1abcdefghi

2from typing_extensions import Annotated 1abcdefghi

3 

4app = typer.Typer() 1abcdefghi

5 

6 

7@app.command() 1abcdefghi

8def main( 1abcdefghi

9 name: Annotated[str, typer.Option("--name", "-n")], 

10 formal: Annotated[bool, typer.Option("--formal", "-f")] = False, 

11): 

12 if formal: 1abcdefghi

13 print(f"Good day Ms. {name}.") 1abcdefghi

14 else: 

15 print(f"Hello {name}") 1abcdefghi

16 

17 

18if __name__ == "__main__": 1abcdefghi

19 app() 1abcdefghi