Coverage for docs_src / parameter_types / bool / tutorial002_py39.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
1from typing import Optional 1abcdefgh
3import typer 1abcdefgh
5app = typer.Typer() 1abcdefgh
8@app.command() 1abcdefgh
9def main(accept: Optional[bool] = typer.Option(None, "--accept/--reject")): 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
18if __name__ == "__main__": 1abcdefgh
19 app() 1abcdefgh