Coverage for docs_src/options_autocompletion/tutorial002.py: 100%

7 statements  

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

1import typer 1habcdefg

2 

3 

4def complete_name(): 1habcdefg

5 return ["Camila", "Carlos", "Sebastian"] 1habcdefg

6 

7 

8app = typer.Typer() 1habcdefg

9 

10 

11@app.command() 1habcdefg

12def main( 1abcdefg

13 name: str = typer.Option( 

14 "World", help="The name to say hi to.", autocompletion=complete_name 

15 ), 

16): 

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

18 

19 

20if __name__ == "__main__": 1habcdefg

21 app() 1habcdefg