Coverage for tests/assets/compat_click7_8.py: 100%

9 statements  

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

1from typing import List 1habcdefg

2 

3import click 1habcdefg

4import typer 1habcdefg

5 

6app = typer.Typer() 1habcdefg

7 

8 

9def shell_complete( 1abcdefg

10 ctx: click.Context, param: click.Parameter, incomplete: str 

11) -> List[str]: 

12 return ["Jonny"] 1habcdefg

13 

14 

15@app.command(context_settings={"auto_envvar_prefix": "TEST"}) 1habcdefg

16def main( 1abcdefg

17 name: str = typer.Option("John", hidden=True), 

18 lastname: str = typer.Option("Doe", "/lastname", show_default="Mr. Doe"), 

19 age: int = typer.Option(lambda: 42, show_default=True), 

20 nickname: str = typer.Option("", shell_complete=shell_complete), 

21): 

22 """ 

23 Say hello. 

24 """ 

25 print(f"Hello {name} {lastname}, it seems you have {age}, {nickname}") 1habcdefg

26 

27 

28if __name__ == "__main__": 1habcdefg

29 app() 1habcdefg