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

11 statements  

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

1import typer 1abcdefghij

2from typer import _click 1abcdefghij

3from typer.core import _TyperParameter 1abcdefghij

4 

5app = typer.Typer() 1abcdefghij

6 

7 

8def shell_complete(ctx: _click.Context, param: _TyperParameter, incomplete: str): 1abcdefghij

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

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

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

12 return ["Emma"] 1abcdefghij

13 

14 

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

16def main(name: str = typer.Argument(shell_complete=shell_complete)): 1abcdefghij

17 """ 

18 Say hello. 

19 """ 

20 

21 

22if __name__ == "__main__": 1abcdefghij

23 app() 1abcdefghij