Coverage for docs_src / parameter_types / bool / tutorial002_an_py39.py: 100%

10 statements  

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

1from typing import Annotated, Optional 1abcdefgh

2 

3import typer 1abcdefgh

4 

5app = typer.Typer() 1abcdefgh

6 

7 

8@app.command() 1abcdefgh

9def main(accept: Annotated[Optional[bool], typer.Option("--accept/--reject")] = None): 1abcdefgh

10 if accept is None: 1abcdefgh

11 print("I don't know what you want yet") 1abcdefgh

12 elif accept: 1abcdefgh

13 print("Accepting!") 1abcdefgh

14 else: 

15 print("Rejecting!") 1abcdefgh

16 

17 

18if __name__ == "__main__": 1abcdefgh

19 app() 1abcdefgh