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
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
1import typer 1iabcdefgh
4def complete_name(): 1iabcdefgh
5 return ["Camila", "Carlos", "Sebastian"] 1iabcdefgh
8app = typer.Typer() 1iabcdefgh
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
20if __name__ == "__main__": 1iabcdefgh
21 app() 1iabcdefgh