Coverage for docs_src/commands/help/tutorial007.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 Union 1habcdefg
3import typer 1habcdefg
5app = typer.Typer(rich_markup_mode="rich") 1habcdefg
8@app.command() 1habcdefg
9def create( 1abcdefg
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}") 1habcdefg
30@app.command(rich_help_panel="Utils and Configs") 1habcdefg
31def config(configuration: str): 1habcdefg
32 """
33 [blue]Configure[/blue] the system. :wrench:
34 """
35 print(f"Configuring the system with: {configuration}") 1habcdefg
38if __name__ == "__main__": 1habcdefg
39 app() 1habcdefg