6 #include <boost/program_options.hpp>
7 #include <boost/lambda/lambda.hpp>
8 #include <boost/lambda/bind.hpp>
15 using namespace boost::lambda;
19 void process(
const std::string& file_name)
21 std::cout <<
"Processing... " << file_name << std::endl;
22 osl::Ki2File ki2(file_name, !
quiet);
26 const osl::Record record = ki2.getRecord();
28 std::for_each(moves.begin(), moves.end(),
29 std::cout << _1 <<
"\n" );
39 int main(
int argc,
char **argv)
41 boost::program_options::options_description command_line_options;
42 command_line_options.add_options()
43 (
"quiet,q",
"quiet output")
44 (
"input-file", boost::program_options::value< std::vector<std::string> >(),
45 "input files in ki2 format (.ki2)")
46 (
"help,h",
"Show help message");
47 boost::program_options::variables_map
vm;
48 boost::program_options::positional_options_description p;
49 p.add(
"input-file", -1);
54 boost::program_options::command_line_parser(
55 argc, argv).options(command_line_options).positional(p).
run(), vm);
56 boost::program_options::notify(vm);
60 "Usage: " << argv[0] <<
" [options] ki2-file [ki2-file...]"
62 std::cout << command_line_options << std::endl;
65 if (vm.count(
"quiet"))
68 catch (std::exception &e)
70 std::cerr <<
"error in parsing options" << std::endl
71 << e.what() << std::endl;
73 "Usage: " << argv[0] <<
" [options] ki2-file [ki2-file...]"
75 std::cerr << command_line_options << std::endl;
79 const std::vector<std::string>
files =
80 vm[
"input-file"].as< std::vector<std::string> >();
81 std::for_each(files.begin(), files.end(), bind(&
process, _1));