Coverage for docs_src/parameter_types/bool/tutorial002_an.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 18:26 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 18:26 +0000
1from typing import Optional 1abcdefgh
3import typer 1abcdefgh
4from typing_extensions import Annotated 1abcdefgh
7def main(accept: Annotated[Optional[bool], typer.Option("--accept/--reject")] = None): 1abcdefgh
8 if accept is None: 1abcdefgh
9 print("I don't know what you want yet") 1abcdefgh
10 elif accept: 1abcdefgh
11 print("Accepting!") 1abcdefgh
12 else:
13 print("Rejecting!") 1abcdefgh
16if __name__ == "__main__": 1abcdefgh
17 typer.run(main) 1abcdefgh