Coverage for tests / test_completion / colon_example.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
1import typer 1abcdefghij
3image_desc = [ 1abcdefghij
4 ("alpine:latest", "latest alpine image"),
5 ("alpine:hello", "fake image: for testing"),
6 ("nvidia/cuda:10.0-devel-ubuntu18.04", ""),
7]
10def _complete(incomplete: str) -> str: 1abcdefghij
11 for image, desc in image_desc: 1abcdefghij
12 if image.startswith(incomplete): 1abcdefghij
13 yield image, desc 1abcdefghij
16app = typer.Typer() 1abcdefghij
19@app.command() 1abcdefghij
20def image(name: str = typer.Option(autocompletion=_complete)): 1abcdefghij
21 typer.echo(name) 1abcdefghij
24if __name__ == "__main__": 1abcdefghij
25 app() 1abcdefghij