diff --git a/src/commandline.cpp b/src/commandline.cpp index 4d55418..64ac03e 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -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")) {