Coverage for docs_src/options/help/tutorial002_an.py: 100%
6 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
1import typer 1iabcdefgh
2from typing_extensions import Annotated 1iabcdefgh
5def main( 1abcdefgh
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: 1iabcdefgh
27 print(f"Good day Ms. {name} {lastname}.") 1iabcdefgh
28 else:
29 print(f"Hello {name} {lastname}") 1iabcdefgh
32if __name__ == "__main__": 1iabcdefgh
33 typer.run(main) 1iabcdefgh