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

7 statements  

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

1import typer 1iabcdefgh

2 

3 

4def complete_name(): 1iabcdefgh

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

6 

7 

8app = typer.Typer() 1iabcdefgh

9 

10 

11@app.command() 1iabcdefgh

12def main( 1abcdefgh

13 name: str = typer.Option( 

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

15 ), 

16): 

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

18 

19 

20if __name__ == "__main__": 1iabcdefgh

21 app() 1iabcdefgh