Coverage for docs_src / commands / help / tutorial005.py: 100%
9 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
1from typing import Annotated 1abcdefghij
3import typer 1abcdefghij
5app = typer.Typer(rich_markup_mode="markdown") 1abcdefghij
8@app.command() 1abcdefghij
9def create( 1abcdefghij
10 username: Annotated[str, typer.Argument(help="The username to be **created**")],
11):
12 """
13 **Create** a new *shiny* user. :sparkles:
15 * Create a username
17 * Show that the username is created
19 ---
21 Learn more at the [Typer docs website](https://typer.tiangolo.com)
22 """
23 print(f"Creating user: {username}") 1abcdefghij
26@app.command(help="**Delete** a user with *username*.") 1abcdefghij
27def delete( 1abcdefghij
28 username: Annotated[str, typer.Argument(help="The username to be **deleted**")],
29 force: Annotated[bool, typer.Option(help="Force the **deletion** :boom:")] = False,
30):
31 """
32 Some internal utility function to delete.
33 """
34 print(f"Deleting user: {username}") 1abcdefghij
37if __name__ == "__main__": 1abcdefghij
38 app() 1abcdefghij