Show some readable message when being passed an unknown option.
This commit is contained in:
parent
05af365c58
commit
c947eab83f
1 changed files with 7 additions and 1 deletions
|
@ -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")) {
|
||||
|
|
Loading…
Reference in a new issue