Skip to content
Snippets Groups Projects
Commit f003c8a0 authored by Marco Biasini's avatar Marco Biasini
Browse files

perform command line parsing in try/catch block

parent dcefa4e2
No related branches found
No related tags found
No related merge requests found
...@@ -127,9 +127,14 @@ int main (int argc, char **argv) ...@@ -127,9 +127,14 @@ int main (int argc, char **argv)
po::positional_options_description p; po::positional_options_description p;
p.add("files", -1); p.add("files", -1);
po::variables_map vm; po::variables_map vm;
po::store(po::command_line_parser(argc, argv). try {
po::store(po::command_line_parser(argc, argv).
options(desc).positional(p).run(), options(desc).positional(p).run(),
vm); vm);
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
usage();
}
po::notify(vm); po::notify(vm);
if (vm.count("version")) { if (vm.count("version")) {
std::cout << "Version: " << version << std::endl; std::cout << "Version: " << version << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment