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

10 statements  

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

1import typer 1habcdefg

2 

3app = typer.Typer() 1habcdefg

4 

5 

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

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

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

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

10 return [ 1abcdefg

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

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

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

14 ] 

15 

16 

17@app.command() 1habcdefg

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

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

20 

21 

22if __name__ == "__main__": 1habcdefg

23 app() 1habcdefg