25 |
#include <boost/program_options.hpp> |
#include <boost/program_options.hpp> |
26 |
#include "build_info.hpp" |
#include "build_info.hpp" |
27 |
|
|
|
typedef std::pair<std::string, std::string> StringPair; |
|
|
typedef std::vector<std::string> StringVector; |
|
|
|
|
|
namespace boost |
|
|
{ |
|
|
namespace program_options |
|
|
{ |
|
|
void validate(boost::any& value_store, |
|
|
const StringVector& values, |
|
|
std::vector<StringPair> *, |
|
|
int) |
|
|
{ |
|
|
using namespace boost::algorithm; |
|
|
|
|
|
StringVector tokens; |
|
|
|
|
|
split(tokens, values[0], is_space()); |
|
|
if (tokens.size() != 2) |
|
|
throw validation_error("invalid string pair"); |
|
|
|
|
|
value_store = boost::any(std::make_pair(tokens[0], tokens[1])); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
28 |
namespace usata |
namespace usata |
29 |
{ |
{ |
30 |
namespace po = boost::program_options; |
namespace po = boost::program_options; |
48 |
("help,h" , "show this help message") |
("help,h" , "show this help message") |
49 |
("version,v", "print version") |
("version,v", "print version") |
50 |
("config,c" , po::value<std::string>(), "specify path to configuration file") |
("config,c" , po::value<std::string>(), "specify path to configuration file") |
51 |
("set,s" , po::value<std::vector<StringPair> >()->multitoken(), "set configuration option(s)") |
("set,s" , po::value<std::vector<std::string> >()->multitoken(), "set configuration option(s)") |
52 |
; |
; |
53 |
|
|
54 |
po::variables_map var_map; |
po::variables_map var_map; |
98 |
} |
} |
99 |
|
|
100 |
return op_conf.release(); |
return op_conf.release(); |
101 |
} |
} |
102 |
|
|
103 |
} |
} // namespace usata |