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

1import typer 1habcdefg

2from typing_extensions import Annotated 1habcdefg

3 

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

5 

6 

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: 

13 

14 * Create a username 

15 

16 * Show that the username is created 

17 

18 --- 

19 

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

21 """ 

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

23 

24 

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

34 

35 

36if __name__ == "__main__": 1habcdefg

37 app() 1habcdefg