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

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1import typer 1abcdefghi

2 

3app = typer.Typer() 1abcdefghi

4 

5 

6def complete(ctx, args, incomplete): 1abcdefghi

7 typer.echo(f"info name is: {ctx.info_name}", err=True) 1abcdefghi

8 typer.echo(f"args is: {args}", err=True) 1abcdefghi

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

10 return [ 1abcdefghi

11 ("Camila", "The reader of books."), 

12 ("Carlos", "The writer of scripts."), 

13 ("Sebastian", "The type hints guy."), 

14 ] 

15 

16 

17@app.command() 1abcdefghi

18def main(name: str = typer.Option("World", autocompletion=complete)): 1abcdefghi

19 print(f"Hello {name}") 1abcdefghi

20 

21 

22if __name__ == "__main__": 1abcdefghi

23 app() 1abcdefghi