Show some readable message when being passed an unknown option.

This commit is contained in:
King_DuckZ 2015-09-30 01:14:47 +02:00
parent 05af365c58
commit c947eab83f

View file

@ -37,7 +37,13 @@ namespace duck {
all.add(desc).add(positional_options);
po::positional_options_description pd;
pd.add("input-url", 1).add("xpath", 1);
po::store(po::command_line_parser(parArgc, parArgv).options(all).positional(pd).run(), parVarMap);
try {
po::store(po::command_line_parser(parArgc, parArgv).options(all).positional(pd).run(), parVarMap);
}
catch (const po::unknown_option& err) {
throw std::invalid_argument(err.what());
}
po::notify(parVarMap);
if (parVarMap.count("help")) {