Coverage for docs_src / commands / help / tutorial005_an_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 Annotated 1abcdefgh
3import typer 1abcdefgh
5app = typer.Typer(rich_markup_mode="markdown") 1abcdefgh
8@app.command() 1abcdefgh
9def create( 1abcdefgh
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}") 1abcdefgh
26@app.command(help="**Delete** a user with *USERNAME*.") 1abcdefgh
27def delete( 1abcdefgh
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}") 1abcdefgh
37if __name__ == "__main__": 1abcdefgh
38 app() 1abcdefgh