Toggling input parsing/processing #1142
-
Is it possible to temporarily disable cmd2's input processing? Maybe function calls to enable/disable the handler? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
GNU readline adds to its up-arrow history by default when you call This function provides a lot of more features than Here is the function signature. Here is an example that demonstrates the various ways you can use |
Beta Was this translation helpful? Give feedback.
GNU readline adds to its up-arrow history by default when you call
input()
. For this reason, cmd2 has a wrapper method calledread_input()
.This function provides a lot of more features than
input()
, like custom tab completion and custom up-arrow history items while the user is typing their input. For the case in which you want no history available to the user while typing and you do not want to store their input in the history, just call like this:self.read_input(prompt)
.Here is the function signature.
https://cmd2.readthedocs.io/en/latest/api/cmd.html#cmd2.Cmd.read_input
Here is an example that demonstrates the various ways you can use
read_input()
.https://github.com/python-cmd2/cmd2…