[core] fixed process' dup2
[ozulis.git] / src / moulette / main.cc
blob248519871a5a49592c6d1983d91554798851b6ef
1 #include <iostream>
2 #include <boost/program_options.hpp>
3 #include <boost/foreach.hpp>
5 #include <moulette/moulette.hh>
6 #include <moulette/listeners/console-listener.hh>
7 #include <moulette/listeners/xml-listener.hh>
9 namespace po = boost::program_options;
11 int main(int argc, char **argv)
13 po::options_description desc("Help");
14 desc.add_options()
15 ("help,h", "produce help message")
16 ("tests,t", po::value< std::vector<std::string> >(), "test files");
18 po::positional_options_description pdesc;
19 pdesc.add("tests", -1);
21 po::variables_map vm;
22 po::store(po::command_line_parser(argc, argv).
23 options(desc).positional(pdesc).run(), vm);
24 po::notify(vm);
26 if (vm.count("help")) {
27 std::cout << desc << "\n";
28 return 0;
31 moulette::Moulette & moul = moulette::Moulette::instance();
32 if (vm.count("tests"))
34 BOOST_FOREACH(const std::string & filename,
35 vm["tests"].as<std::vector<std::string> >())
36 moul.addTest(filename);
39 moul.registerListener(*new moulette::ConsoleListener);
40 moul.registerListener(*new moulette::XmlListener);
41 moul.run();
43 return 0;