Coverage for docs_src/parameter_types/bool/tutorial003_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(force: Annotated[bool, typer.Option("--force/--no-force", "-f/-F")] = False): 1abcdefghi

9 if force: 1abcdefghi

10 print("Forcing operation") 1abcdefghi

11 else: 

12 print("Not forcing") 1abcdefghi

13 

14 

15if __name__ == "__main__": 1abcdefghi

16 app() 1abcdefghi