Coverage for docs_src/commands/help/tutorial005.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import typer 1habcdefg

2 

3app = typer.Typer(rich_markup_mode="markdown") 1habcdefg

4 

5 

6@app.command() 1habcdefg

7def create(username: str = typer.Argument(..., help="The username to be **created**")): 1habcdefg

8 """ 

9 **Create** a new *shiny* user. :sparkles: 

10 

11 * Create a username 

12 

13 * Show that the username is created 

14 

15 --- 

16 

17 Learn more at the [Typer docs website](https://typer.tiangolo.com) 

18 """ 

19 print(f"Creating user: {username}") 1habcdefg

20 

21 

22@app.command(help="**Delete** a user with *USERNAME*.") 1habcdefg

23def delete( 1abcdefg

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}") 1habcdefg

31 

32 

33if __name__ == "__main__": 1habcdefg

34 app() 1habcdefg