Coverage for docs_src/commands/help/tutorial005_an.py: 100%
9 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
4app = typer.Typer(rich_markup_mode="markdown") 1iabcdefgh
7@app.command() 1iabcdefgh
8def create( 1abcdefgh
9 username: Annotated[str, typer.Argument(help="The username to be **created**")],
10):
11 """
12 **Create** a new *shinny* user. :sparkles:
14 * Create a username
16 * Show that the username is created
18 ---
20 Learn more at the [Typer docs website](https://typer.tiangolo.com)
21 """
22 print(f"Creating user: {username}") 1iabcdefgh
25@app.command(help="**Delete** a user with *USERNAME*.") 1iabcdefgh
26def delete( 1abcdefgh
27 username: Annotated[str, typer.Argument(help="The username to be **deleted**")],
28 force: Annotated[bool, typer.Option(help="Force the **deletion** :boom:")] = False,
29):
30 """
31 Some internal utility function to delete.
32 """
33 print(f"Deleting user: {username}") 1iabcdefgh
36if __name__ == "__main__": 1iabcdefgh
37 app() 1iabcdefgh