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

8 statements  

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

1import typer 1abcdefghi

2from typing_extensions import Annotated 1abcdefghi

3 

4 

5def complete_name(): 1abcdefghi

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

7 

8 

9app = typer.Typer() 1abcdefghi

10 

11 

12@app.command() 1abcdefghi

13def main( 1abcdefghi

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}") 1abcdefghi

19 

20 

21if __name__ == "__main__": 1abcdefghi

22 app() 1abcdefghi