1 //! \file BoostPoCommandLineParser.cpp
3 #include "BoostPoCommandLineParser.h"
7 #include "CommandLineParserUtils.h"
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");
20 po::value
<std::string
>()->value_name("dotfile"),
21 "file for dot output");
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
);
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
)
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"
67 << " for curl." << std::endl
;
69 } // namespace WikiWalker