Does anyone know of a C++ library that will provide a text-based interactive interface? I want to create two versions of an application; a console based program that will perform whatever actions are given on the command line or interactively at the console as well as a GUI based program (Mac Cocoa and Windows MFC). Both versions will share a common C++ backend.
For the console based program I would like similar history abilities to readline (which I cannot use as this application will be closed source) with command completion (Tab-activated for example).
Perhaps there is something like this already available?
In no particular order, (I've used none of them,) you should have a look at:
If none of those take your fancy you have one other possibility, and perhaps it may even be preferred. Write your backend as a daemon and have the frontend be a dumb program that communicates with the backend via any form of inter process communication. You can then use any GPLed library for your frontend without any problem as you can release the frontend as open source. Of course this will expose the communication protocol between frontend and backend, so you must be sure to be okay with that and of course the possibility that others may feel the need to make customizations to your frontend and perhaps even make their own. But assuming that your value is in the backend anyway, this should not pose a particular problem. And it may even be considered a plus, it would allow anyone with a bright idea to use your software in new and unexpected ways only increasing the popularity of your software.
Update: I haven't found a satisfactory (cross-platform) solution to the history/completion option, so I've ignored that for the time being, but I wanted to update this question with how I've implemented a simple interactive class. This interface won't be for mainstream user's but I'm finding it very handy for testing my code during implementation. Below is the initial implementation that might help others out (note that this code references methods and types I have not published, so won't compile out of the box)
Interact.h:
Interact.cpp: