po::variables_map vm;
try {
- CLICommand::ParseCommand(argc, argv, visibleDesc, hiddenDesc, positionalDesc,
- vm, cmdname, command, autocomplete);
+ if (!CLICommand::ParseCommand(argc, argv, visibleDesc, hiddenDesc, positionalDesc,
+ vm, cmdname, command, autocomplete)) {
+
+ Log(LogCritical, "icinga-app")
+ << "Command parsing error. Try '--help'.";
+ return EXIT_FAILURE;
+ }
} catch (const std::exception& ex) {
Log(LogCritical, "icinga-app")
<< "Error while parsing command-line options: " << ex.what();
visibleDesc.add(vdesc);
}
- if (autocomplete || (tried_command && !command))
+ if (autocomplete)
return true;
+ if (tried_command && !command)
+ return false;
+
po::options_description adesc;
adesc.add(visibleDesc);
adesc.add(hiddenDesc);