Revert "CLI: Return non-zero on unknown sub commands"

This reverts commit 00bc0b2303.
This commit is contained in:
Michael Friedrich 2019-05-10 15:16:05 +02:00
parent af42e2dfc0
commit aed88ca477
2 changed files with 3 additions and 11 deletions

View File

@ -327,13 +327,8 @@ static int Main()
po::variables_map vm;
try {
if (!CLICommand::ParseCommand(argc, argv, visibleDesc, hiddenDesc, positionalDesc,
vm, cmdname, command, autocomplete)) {
Log(LogCritical, "icinga-app")
<< "Command parsing error. Try '--help'.";
return EXIT_FAILURE;
}
CLICommand::ParseCommand(argc, argv, visibleDesc, hiddenDesc, positionalDesc,
vm, cmdname, command, autocomplete);
} catch (const std::exception& ex) {
Log(LogCritical, "icinga-app")
<< "Error while parsing command-line options: " << ex.what();

View File

@ -200,12 +200,9 @@ found_command:
visibleDesc.add(vdesc);
}
if (autocomplete)
if (autocomplete || (tried_command && !command))
return true;
if (tried_command && !command)
return false;
po::options_description adesc;
adesc.add(visibleDesc);
adesc.add(hiddenDesc);