| 6 | |
| 7 | |
| 8 | class AutoStyleApp(cmd2.Cmd): |
| 9 | def __init__(self): |
| 10 | super().__init__() |
| 11 | |
| 12 | def do_foo(self, args): |
| 13 | pass |
| 14 | |
| 15 | def complete_foo(self, text, line, begidx, endidx) -> Completions: |
| 16 | # Return 10 items |
| 17 | items = [f"item{i}" for i in range(10) if f"item{i}".startswith(text)] |
| 18 | return Completions.from_values(items) |
| 19 | |
| 20 | def do_bar(self, args): |
| 21 | pass |
| 22 | |
| 23 | def complete_bar(self, text, line, begidx, endidx) -> Completions: |
| 24 | # Return 5 items |
| 25 | items = [f"item{i}" for i in range(5) if f"item{i}".startswith(text)] |
| 26 | return Completions.from_values(items) |
| 27 | |
| 28 | |
| 29 | @pytest.fixture |