Skip to content

Toggling input parsing/processing #1142

Answered by kmvanbrunt
A1-exe asked this question in Q&A
Discussion options

You must be logged in to vote

GNU readline adds to its up-arrow history by default when you call input(). For this reason, cmd2 has a wrapper method called read_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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by A1-exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants