Call read_input to use custom history and choices.
(self, _)
| 38 | |
| 39 | @cmd2.with_category(EXAMPLE_COMMANDS) |
| 40 | def do_custom_choices(self, _) -> None: |
| 41 | """Call read_input to use custom history and choices.""" |
| 42 | self.poutput("Tab completing with static choices list and using custom history") |
| 43 | try: |
| 44 | input_str = self.read_input( |
| 45 | "> ", |
| 46 | history=self.custom_history, |
| 47 | choices=["choice_1", "choice_2", "choice_3"], |
| 48 | ) |
| 49 | except EOFError: |
| 50 | pass |
| 51 | else: |
| 52 | self.custom_history.append(input_str) |
| 53 | |
| 54 | def choices_provider(self) -> cmd2.Choices: |
| 55 | """Example choices provider function.""" |
nothing calls this directly
no test coverage detected