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

8 statements  

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

1import typer 1habcdefg

2from typing_extensions import Annotated 1habcdefg

3 

4 

5def complete_name(): 1habcdefg

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

7 

8 

9app = typer.Typer() 1habcdefg

10 

11 

12@app.command() 1habcdefg

13def main( 1abcdefg

14 name: Annotated[ 

15 str, typer.Option(help="The name to say hi to.", autocompletion=complete_name) 

16 ] = "World", 

17): 

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

19 

20 

21if __name__ == "__main__": 1habcdefg

22 app() 1habcdefg