I'm writing a command line console application that receives input from user and interprets it as a command and performs the necessary action (like metasploit console). My application is already done and ready to go but my problem is I implemented it with input() function which does not handle arrow keys. If I mistype something and not notice it, I have to delete every character back to that typo and retype the rest of the command. I want to implement it in a way that would accept arrow keys to navigate around the characters. Is there anyone who knows how to do that?
(As I specified above, I'm trying to find a way to do that with curses library. But any other library that can do what I need would be highly appreciated)
Code example:
while True:
command = input("command >")
if command == "say_hello":
print("Hello")
elif command == "exit":
exit()
else:
print("Undefined command")