From aed88ca4779b91dcfb5c58e7526b65a666cb5a9a Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 10 May 2019 15:16:05 +0200 Subject: [PATCH] Revert "CLI: Return non-zero on unknown sub commands" This reverts commit 00bc0b230357bf02c1c9da4ca59c2d359c73a538. --- icinga-app/icinga.cpp | 9 ++------- lib/cli/clicommand.cpp | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index ca103f314..5d3e3165e 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.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(); diff --git a/lib/cli/clicommand.cpp b/lib/cli/clicommand.cpp index 7e93c5c61..878beac77 100644 --- a/lib/cli/clicommand.cpp +++ b/lib/cli/clicommand.cpp @@ -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);