Introduce version 0.1
[dueringa_WikiWalker.git] / src / BoostPoCommandLineParser.cpp
blob1ba49e3b693d764c9a509b3fd6b1b4ee04f4df8d
1 //! \file BoostPoCommandLineParser.cpp
3 #include "BoostPoCommandLineParser.h"
5 #include <iostream>
7 BoostPoCommandLineParser::BoostPoCommandLineParser() :
8 cmdOptions("Allowed options"),
9 input("Input URLs")
11 cmdOptions.add_options()
12 ("version,v", "produce version message")
13 ("help,h", "produce help message")
14 ("dot-out,o", po::value<std::string>(), "file for dot output (unused)")
15 ("json-cache,j", po::value<std::string>(), "file for json cache file")
18 input.add_options()
19 ("url", po::value<std::string>(), "URL")
20 //("url", po::value<vector<string>>(), "URL")
23 cmdline_options.add(cmdOptions).add(input);
25 p.add("url", 1);
28 std::string BoostPoCommandLineParser::getValue(std::string option)
30 assert(hasSet(option));
31 return vm[option].as<std::string>();
34 bool BoostPoCommandLineParser::hasSet(std::string flag)
36 return vm.count(flag);
39 void BoostPoCommandLineParser::parse(int argc, char** argv)
41 // po::store(po::parse_command_line(argc, argv, desc), vm);
42 po::store(po::command_line_parser(argc, argv)
43 .options(cmdline_options).positional(p).run(), vm);
44 po::notify(vm);
47 void BoostPoCommandLineParser::printHelp()
49 std::cout << "Usage: walker [options] URL" << std::endl;
50 std::cout << cmdOptions << std::endl;