|
Boost Users : |
From: Pfligersdorffer, Christian (Christian.Pfligersdorffer_at_[hidden])
Date: 2007-08-20 04:20:44
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_at_[hidden] 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::vector<std::string> ¶meters) { > for (std::vector<std::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::vector<std::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_at_[hidden] > http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net