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