CLI: A boost command line interpreter based on boost Program Option
Hi all, I wrote a little command line interpreter based on the program option library by Vladimir Prus. You can find it here: http://minilien.com/?bNPy1ECuWv. It's not a big thing but can help sometime. You also have the subversion repository there: http://code.google.com/p/clipo/ Let me know what you think. JD
JD wrote:
Hi all,
I wrote a little command line interpreter based on the program option library by Vladimir Prus. You can find it here: http://minilien.com/?bNPy1ECuWv.
It's not a big thing but can help sometime. You also have the subversion repository there: http://code.google.com/p/clipo/
Let me know what you think.
JD
An example for those who don't like the web pages. Example: ///// namespace po = boost::program_options; void handler(const std::vectorstd::string ¶meters) { for (std::vectorstd::string::const_iterator it = parameters.begin(); it != parameters.end(); ++it) std::cout << *it << std::endl; } void exit_(unsigned int code = 0) { exit(code); } int main(int argc, char **argv) { boost::cli::commands_description desc; desc.add_options() ("handler", po::value< std::vectorstd::string
()->notifier(&handler)->multitoken()) ("exit", po::value< unsigned int >()->notifier(&exit_)) ;
boost::cli::command_line_interpreter cli(desc, ">"); cli.interpret(std::cin); } ////// Output:
handler error: required parameter is missing in 'handler' handler 1 2 3 1 2 3 toto error: unknown option toto exit 0 Press any key to continue . . .
JD
JD writes:
JD wrote:
Hi all,
I wrote a little command line interpreter based on the program option library by Vladimir Prus. You can find it here: http://minilien.com/?bNPy1ECuWv.
It's not a big thing but can help sometime. You also have the subversion repository there: http://code.google.com/p/clipo/
Let me know what you think.
JD
Do you have any intention of replicating the functionality of GNU readline? That would be awfully nice, since the readline license is very restrictive (GPL as opposed to LGPL). -Bryan
Bryan Green wrote:
Do you have any intention of replicating the functionality of GNU readline? That would be awfully nice, since the readline license is very restrictive (GPL as opposed to LGPL).
Everything program_option can do, cli can. Now do we want to replicate readline? I don't know, if people are interested in some additional functionnality just let me know or post issues on http://code.google.com/p/clipo/issues/list. Thanks. JD
Hey JD, that's great, thanks for posting it here!! I was looking for something like that after I unsucessfully tried to use boost::program_options directly. (I did not really expect it to work with /clr...) Since I am playing around with C++/CLI and on the other side really got to like boost::program_options your lib comes in very handy to me. What are the license terms? Regards, -- Christian Pfligersdorffer Software Engineering http://www.eos.info boost-users-bounces@lists.boost.org wrote:
JD wrote:
Hi all,
I wrote a little command line interpreter based on the program option library by Vladimir Prus. You can find it here: http://minilien.com/?bNPy1ECuWv.
It's not a big thing but can help sometime. You also have the subversion repository there: http://code.google.com/p/clipo/
Let me know what you think.
JD
An example for those who don't like the web pages.
Example:
///// namespace po = boost::program_options;
void handler(const std::vectorstd::string ¶meters) { for (std::vectorstd::string::const_iterator it = parameters.begin(); it != parameters.end(); ++it) std::cout << *it << std::endl; }
void exit_(unsigned int code = 0) { exit(code); }
int main(int argc, char **argv) { boost::cli::commands_description desc; desc.add_options() ("handler", po::value< std::vectorstd::string
()->notifier(&handler)->multitoken()) ("exit", po::value< unsigned int >()->notifier(&exit_)) ;
boost::cli::command_line_interpreter cli(desc, ">"); cli.interpret(std::cin); } //////
Output:
handler error: required parameter is missing in 'handler' handler 1 2 3 1 2 3 toto error: unknown option toto exit 0 Press any key to continue . . .
JD
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Pfligersdorffer, Christian wrote:
Hey JD,
that's great, thanks for posting it here!! I was looking for something like that after I unsucessfully tried to use boost::program_options directly. (I did not really expect it to work with /clr...)
Since I am playing around with C++/CLI and on the other side really got to like boost::program_options your lib comes in very handy to me. What are the license terms?
Hi Christian, License is the boost one. I have updated the headers that were misleading. Latest version on: http://minilien.com/?CZQ2q6pI8D or http://code.google.com/p/clipo/ JD
participants (3)
-
Bryan Green
-
JD
-
Pfligersdorffer, Christian