Add comment to analyzed call
[dueringa_WikiWalker.git] / src / BoostPoCommandLineParser.cpp
blob0c72edb1970d36c6dcac6d33121121ebf71cbe73
1 //! \file BoostPoCommandLineParser.cpp
3 #include "BoostPoCommandLineParser.h"
5 #include <iostream>
7 #include "CommandLineParserUtils.h"
9 namespace WikiWalker
11 BoostPoCommandLineParser::BoostPoCommandLineParser()
12 : cmdOptions("Allowed options"), input("Input URLs")
14 auto o = cmdOptions.add_options();
15 o("version,v", "produce version message");
16 o("help,h", "produce help message");
17 o("deep,d", "whether to fetch and analyze linked articles as well.");
18 o("skip-ssl-verification", "whether to skip SSL verification");
19 o("dot-out,o",
20 po::value<std::string>()->value_name("dotfile"),
21 "file for dot output");
22 o("json-cache,j",
23 po::value<std::string>()->value_name("cache"),
24 "file for json cache file");
26 o = input.add_options();
27 o("url", po::value<std::string>(), "URL")
28 //("url", po::value<vector<string>>(), "URL")
31 cmdline_options.add(cmdOptions).add(input);
33 p.add("url", 1);
36 std::string BoostPoCommandLineParser::getValue(
37 CommandLineParserBase::CommandLineOptions option)
39 assert(hasSet(option));
40 return vm[CommandLineParserUtils::getStringFlag(option)].as<std::string>();
43 bool BoostPoCommandLineParser::hasSet(
44 CommandLineParserBase::CommandLineOptions flag)
46 return vm.count(CommandLineParserUtils::getStringFlag(flag)) != 0u;
49 void BoostPoCommandLineParser::parse(int argc, char** argv)
51 // po::store(po::parse_command_line(argc, argv, desc), vm);
52 po::store(po::command_line_parser(argc, argv)
53 .options(cmdline_options)
54 .positional(p)
55 .run(),
56 vm);
57 po::notify(vm);
60 void BoostPoCommandLineParser::printHelp()
62 std::cout << "Usage: walker [options] URL" << std::endl;
63 std::cout << cmdOptions << std::endl;
64 std::cout << "The environment variable CURL_CA_BUNDLE is read for"
65 " finding a CA bundle"
66 << std::endl
67 << " for curl." << std::endl;
69 } // namespace WikiWalker