So I've written a small program which takes in commands by the users, and then displays the output (after connecting to a server). It's an interactive console of sorts.
However, after using the mongodb and redis command-line clients (which work interactively on the console/terminal), it seems that there must be a library somewhere which provides functionalities such as recording user inputs, accepting up/down keypresses to browse through command history, as well as tab completion framework (not sure how that one would work, but yeah).
What's an ideal library to use for such a thing?
The readline library is a common choice: http://www.gnu.org/s/readline
If you are more ambitious, ncurses gives you more control, but has less functionality to begin with and a steeper learning curve.
Edit: icktoofay mentioned that readline is licensed under the GPL. If this is a problem for your software, tecla is an alternative licensed under an X11 style license, so it can be used in proprietary projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With