I have an existing jar file that implements a rudimentary shell interface to a framework. e.g. for comparison, refer to the "mysql" command line app that allows you to connect to MySql databases, query etc..
The problem is that this shell interface does not implement command history. I would like to write an adapter shell that provides command history and command completion like the facility in unix shells.
What
pattern is applicable here ?
From a data structure perspective, a stack is probably what I need. Then I would just need to trap for arrow up and arrow down keys to cycle through the commands.
Now whenever I do an arrow up, I get a ^[[A and when I do a arrow down I get a [[B^ in the command line.
Regards,
Pho