Skip to content
Permalink
Browse files

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

This reverts commit 00bc0b2.
  • Loading branch information...
dnsmichi committed May 10, 2019
1 parent af42e2d commit aed88ca4779b91dcfb5c58e7526b65a666cb5a9a
Showing with 3 additions and 11 deletions.
  1. +2 −7 icinga-app/icinga.cpp
  2. +1 −4 lib/cli/clicommand.cpp
@@ -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();
@@ -200,12 +200,9 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
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);

0 comments on commit aed88ca

Please sign in to comment.
You can’t perform that action at this time.