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

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-04-14 00:18 +0000

1import typer 1iabcdefgh

2 

3app = typer.Typer() 1iabcdefgh

4 

5 

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

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

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

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

10 return [ 1abcdefgh

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

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

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

14 ] 

15 

16 

17@app.command() 1iabcdefgh

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

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

20 

21 

22if __name__ == "__main__": 1iabcdefgh

23 app() 1iabcdefgh