Coverage for docs_src / multiple_values / options_with_multiple_values / tutorial001_an_py39.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-02-09 12:36 +0000

1from typing import Annotated 1abcdefgh

2 

3import typer 1abcdefgh

4 

5app = typer.Typer() 1abcdefgh

6 

7 

8@app.command() 1abcdefgh

9def main(user: Annotated[tuple[str, int, bool], typer.Option()] = (None, None, None)): 1abcdefgh

10 username, coins, is_wizard = user 1abcdefgh

11 if not username: 1abcdefgh

12 print("No user provided") 1abcdefgh

13 raise typer.Abort() 1abcdefgh

14 print(f"The username {username} has {coins} coins") 1abcdefgh

15 if is_wizard: 1abcdefgh

16 print("And this user is a wizard!") 1abcdefgh

17 

18 

19if __name__ == "__main__": 1abcdefgh

20 app() 1abcdefgh