How to implement bash history-like up/down arrow key function in python 3.10

Viewed 94

I'm working on a shell written entirely in python 3.10 for the purposes of teaching myself python and just messing around. I'm currently trying to implement being able to hit the up/down arrow keys to access previously entered commands like bash does but I have absolutely no idea how to implement this and I haven't found anybody else who's tried. Does anybody have any ideas for this if it is possible? Specifically I am unsure how to change the input line in the terminal (replacing the ^[[A and ^[[B).

0 Answers
Related