Coverage for docs_src/commands/help/tutorial005_an.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
1import typer 1habcdefg
2from typing_extensions import Annotated 1habcdefg
4app = typer.Typer(rich_markup_mode="markdown") 1habcdefg
7@app.command() 1habcdefg
8def create( 1abcdefg
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}") 1habcdefg
25@app.command(help="**Delete** a user with *USERNAME*.") 1habcdefg
26def delete( 1abcdefg
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}") 1habcdefg
36if __name__ == "__main__": 1habcdefg
37 app() 1habcdefg