Coverage for docs_src / commands / help / tutorial007_py39.py: 100%
9 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 Union 1abcdefgh
3import typer 1abcdefgh
5app = typer.Typer(rich_markup_mode="rich") 1abcdefgh
8@app.command() 1abcdefgh
9def create( 1abcdefgh
10 username: str = typer.Argument(..., help="The username to create"),
11 lastname: str = typer.Argument(
12 "", help="The last name of the new user", rich_help_panel="Secondary Arguments"
13 ),
14 force: bool = typer.Option(False, help="Force the creation of the user"),
15 age: Union[int, None] = typer.Option(
16 None, help="The age of the new user", rich_help_panel="Additional Data"
17 ),
18 favorite_color: Union[str, None] = typer.Option(
19 None,
20 help="The favorite color of the new user",
21 rich_help_panel="Additional Data",
22 ),
23):
24 """
25 [green]Create[/green] a new user. :sparkles:
26 """
27 print(f"Creating user: {username}") 1abcdefgh
30@app.command(rich_help_panel="Utils and Configs") 1abcdefgh
31def config(configuration: str): 1abcdefgh
32 """
33 [blue]Configure[/blue] the system. :gear:
34 """
35 print(f"Configuring the system with: {configuration}") 1abcdefgh
38if __name__ == "__main__": 1abcdefgh
39 app() 1abcdefgh