Coverage for docs_src/options/help/tutorial002_an.py: 100%
6 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
1import typer 1habcdefg
2from typing_extensions import Annotated 1habcdefg
5def main( 1abcdefg
6 name: str,
7 lastname: Annotated[str, typer.Option(help="Last name of person to greet.")] = "",
8 formal: Annotated[
9 bool,
10 typer.Option(
11 help="Say hi formally.", rich_help_panel="Customization and Utils"
12 ),
13 ] = False,
14 debug: Annotated[
15 bool,
16 typer.Option(
17 help="Enable debugging.", rich_help_panel="Customization and Utils"
18 ),
19 ] = False,
20):
21 """
22 Say hi to NAME, optionally with a --lastname.
24 If --formal is used, say hi very formally.
25 """
26 if formal: 1habcdefg
27 print(f"Good day Ms. {name} {lastname}.") 1habcdefg
28 else:
29 print(f"Hello {name} {lastname}") 1habcdefg
32if __name__ == "__main__": 1habcdefg
33 typer.run(main) 1habcdefg