MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / do_custom_choices_provider

Method do_custom_choices_provider

examples/read_input.py:59–71  ·  view source on GitHub ↗

Call read_input to use custom history and choices provider function.

(self, _)

Source from the content-addressed store, hash-verified

57
58 @cmd2.with_category(EXAMPLE_COMMANDS)
59 def do_custom_choices_provider(self, _) -> None:
60 """Call read_input to use custom history and choices provider function."""
61 self.poutput("Tab completing with choices from provider function and using custom history")
62 try:
63 input_str = self.read_input(
64 "> ",
65 history=self.custom_history,
66 choices_provider=ReadInputApp.choices_provider,
67 )
68 except EOFError:
69 pass
70 else:
71 self.custom_history.append(input_str)
72
73 @cmd2.with_category(EXAMPLE_COMMANDS)
74 def do_custom_completer(self, _) -> None:

Callers

nothing calls this directly

Calls 3

poutputMethod · 0.80
read_inputMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected