diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 8e0900ba0..57e9f59cc 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -108,11 +108,21 @@ bool parseOptions (int argc, char** argv, Arguments &info) // there might be a better way to do this bpo::options_description all; all.add(desc).add(hidden); - bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv) - .options(all).positional(p).run(); - bpo::variables_map variables; - bpo::store(valid_opts, variables); + + try + { + bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv) + .options(all).positional(p).run(); + + bpo::store(valid_opts, variables); + } + catch(boost::program_options::unknown_option & x) + { + std::cerr << "ERROR: " << x.what() << std::endl; + return false; + } + bpo::notify(variables); if (variables.count ("help")) diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 510b0c4a0..9aff898b9 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -28,12 +28,23 @@ int main(int argc, char *argv[]) { p_desc.add("ini", 1).add("cfg", 1); bpo::variables_map vm; - bpo::parsed_options parsed = bpo::command_line_parser(argc, argv) - .options(desc) - .positional(p_desc) - .run(); - bpo::store(parsed, vm); + try + { + bpo::parsed_options parsed = bpo::command_line_parser(argc, argv) + .options(desc) + .positional(p_desc) + .run(); + + bpo::store(parsed, vm); + } + catch(boost::program_options::unknown_option & x) + { + std::cerr << "ERROR: " << x.what() << std::endl; + return false; + } + + if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) { std::cout << desc;