Is there interest in a reusable stream-based console?

I’ve recently started to design a header-only reusable console-class that’s based on std::iostream. It can be customized by adding a variable amount of “commands”. The implementation is currently based on std::stream and may support any compatible stream as input and output. A typical example of usage would be (excluding namespaces): console c(console::case_sensitive);//create case-sensitive console, that reads commands from std::cin and outputs to std::cout and std::cerr c += command(“Name of command”, “Description of command”, “Extended information on parameters of command”, function);//add command to console, whereas function is a std::function c();//execute console; console is executed until function to stop is called Is there any interest in adding such a library to boost? greetz Michael

Hi,
I’ve recently started to design a header-only reusable console-class that’s based on std::iostream. It can be customized by adding a variable amount of “commands”. The implementation is currently based on std::stream and may support any compatible stream as input and output.
Is there any interest in adding such a library to boost?
I find this interesting. I have a few questions ideas: - Does it interop with boost.program_options ? It would be nice to be able to trigger behaviour from the command line or the console in a unified way. - How would passing parameters to the said functions work ? - It would be fine to be able to read a list of commands from a file for having a small script languages. Regards, Julien

From: Michael Hava <mfh@live.at>
I’ve recently started to design a header-only reusable console-class that’s
based on std::iostream.
It can be customized by adding a variable amount of “commands”. The implementation is currently based on std::stream and may support any compatible stream as input and output.
Does it does things like GNU Readline does: http://www.gnu.org/s/readline/ I mean: iterative editing, history, search, auto-completion and so on? If so it would be very interesting library for boost. Otherwise it really depends on what is the syntax the application uses and help is something nice but it is also something domain specific. So I'm not 100% sure how helpful it would be... Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/

Hi Michael, On Sat, Mar 3, 2012 at 6:11 PM, Michael Hava <mfh@live.at> wrote:
I’ve recently started to design a header-only reusable console-class that’s based on std::iostream. It can be customized by adding a variable amount of “commands”.
I can understand the header-only motivation, but have you considered using SWIG (http://www.swig.org/) to wrap you C++ in your favorite scripting language and then simply re-using the interactive shell provided by that language? For example, you'd have to write an unbelievable amount of code to provide functionality equivalent to SWIGing your logic into Python and then using from the isympy shell. Presumably also Boost.Python would be a possibility instead of SWIG if you wanted Python. I suggest SWIG only because it supports a broader range of scripting languages and because I know it better. - Rhys
participants (4)
-
Artyom Beilis
-
Julien Nitard
-
Michael Hava
-
Rhys Ulerich