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