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

10 statements  

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

1import click 1abcdefgh

2import typer 1abcdefgh

3 

4app = typer.Typer() 1abcdefgh

5 

6 

7def shell_complete(ctx: click.Context, param: click.Parameter, incomplete: str): 1abcdefgh

8 typer.echo(f"ctx: {ctx.info_name}", err=True) 1abcdefgh

9 typer.echo(f"arg is: {param.name}", err=True) 1abcdefgh

10 typer.echo(f"incomplete is: {incomplete}", err=True) 1abcdefgh

11 return ["Emma"] 1abcdefgh

12 

13 

14@app.command(context_settings={"auto_envvar_prefix": "TEST"}) 1abcdefgh

15def main(name: str = typer.Argument(shell_complete=shell_complete)): 1abcdefgh

16 """ 

17 Say hello. 

18 """ 

19 

20 

21if __name__ == "__main__": 1abcdefgh

22 app() 1abcdefgh