From 82a31c9b2045234800e112c63595d500d2d77328 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 12 Jan 2015 14:29:08 +0100 Subject: [PATCH] Rename the "repl" command to "console" fixes #8167 --- lib/cli/CMakeLists.txt | 2 +- .../{replcommand.cpp => consolecommand.cpp} | 27 ++++++++----------- .../{replcommand.hpp => consolecommand.hpp} | 13 +++++---- 3 files changed, 18 insertions(+), 24 deletions(-) rename lib/cli/{replcommand.cpp => consolecommand.cpp} (88%) rename lib/cli/{replcommand.hpp => consolecommand.hpp} (90%) diff --git a/lib/cli/CMakeLists.txt b/lib/cli/CMakeLists.txt index 18aeb291f..f7b7e7cdd 100644 --- a/lib/cli/CMakeLists.txt +++ b/lib/cli/CMakeLists.txt @@ -19,12 +19,12 @@ set(cli_SOURCES nodeaddcommand.cpp nodeblackandwhitelistcommand.cpp nodelistcommand.cpp noderemovecommand.cpp nodesetcommand.cpp nodesetupcommand.cpp nodeupdateconfigcommand.cpp nodewizardcommand.cpp nodeutility.cpp clicommand.cpp + consolecommand.cpp daemoncommand.cpp featureenablecommand.cpp featuredisablecommand.cpp featurelistcommand.cpp featureutility.cpp objectlistcommand.cpp pkinewcacommand.cpp pkinewcertcommand.cpp pkisigncsrcommand.cpp pkirequestcommand.cpp pkisavecertcommand.cpp pkiticketcommand.cpp pkiutility.cpp - replcommand.cpp repositoryclearchangescommand.cpp repositorycommitcommand.cpp repositoryobjectcommand.cpp repositoryutility.cpp variablegetcommand.cpp variablelistcommand.cpp variableutility.cpp ) diff --git a/lib/cli/replcommand.cpp b/lib/cli/consolecommand.cpp similarity index 88% rename from lib/cli/replcommand.cpp rename to lib/cli/consolecommand.cpp index 5b4b4b327..4d88dada2 100644 --- a/lib/cli/replcommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "cli/replcommand.hpp" +#include "cli/consolecommand.hpp" #include "config/configcompiler.hpp" #include "base/json.hpp" #include "base/console.hpp" @@ -37,29 +37,24 @@ extern "C" { using namespace icinga; namespace po = boost::program_options; -REGISTER_CLICOMMAND("repl", ReplCommand); +REGISTER_CLICOMMAND("console", ConsoleCommand); -String ReplCommand::GetDescription(void) const +String ConsoleCommand::GetDescription(void) const { return "Interprets Icinga script expressions."; } -String ReplCommand::GetShortDescription(void) const +String ConsoleCommand::GetShortDescription(void) const { - return "Icinga REPL console"; + return "Icinga console"; } -bool ReplCommand::IsHidden(void) const -{ - return true; -} - -ImpersonationLevel ReplCommand::GetImpersonationLevel(void) const +ImpersonationLevel ConsoleCommand::GetImpersonationLevel(void) const { return ImpersonateNone; } -void ReplCommand::InitParameters(boost::program_options::options_description& visibleDesc, +void ConsoleCommand::InitParameters(boost::program_options::options_description& visibleDesc, boost::program_options::options_description& hiddenDesc) const { visibleDesc.add_options() @@ -68,11 +63,11 @@ void ReplCommand::InitParameters(boost::program_options::options_description& vi } /** - * The entry point for the "repl" CLI command. + * The entry point for the "console" CLI command. * * @returns An exit status. */ -int ReplCommand::Run(const po::variables_map& vm, const std::vector& ap) const +int ConsoleCommand::Run(const po::variables_map& vm, const std::vector& ap) const { ScriptFrame frame; std::map lines; @@ -167,7 +162,7 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector socket = usocket; } else { #endif /* _WIN32 */ - Log(LogCritical, "ReplCommand", "Sorry, TCP sockets aren't supported yet."); + Log(LogCritical, "ConsoleCommand", "Sorry, TCP sockets aren't supported yet."); return 1; #ifndef _WIN32 } @@ -187,7 +182,7 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector } if (result.GetLength() < 16) { - Log(LogCritical, "ReplCommand", "Received invalid response from Livestatus."); + Log(LogCritical, "ConsoleCommand", "Received invalid response from Livestatus."); continue; } diff --git a/lib/cli/replcommand.hpp b/lib/cli/consolecommand.hpp similarity index 90% rename from lib/cli/replcommand.hpp rename to lib/cli/consolecommand.hpp index bff9504b8..d261a4b89 100644 --- a/lib/cli/replcommand.hpp +++ b/lib/cli/consolecommand.hpp @@ -17,8 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifndef REPLCOMMAND_H -#define REPLCOMMAND_H +#ifndef CONSOLECOMMAND_H +#define CONSOLECOMMAND_H #include "cli/clicommand.hpp" @@ -26,18 +26,17 @@ namespace icinga { /** - * The "repl" CLI command. + * The "console" CLI command. * * @ingroup cli */ -class ReplCommand : public CLICommand +class ConsoleCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(ReplCommand); + DECLARE_PTR_TYPEDEFS(ConsoleCommand); virtual String GetDescription(void) const; virtual String GetShortDescription(void) const; - virtual bool IsHidden(void) const; virtual ImpersonationLevel GetImpersonationLevel(void) const; virtual void InitParameters(boost::program_options::options_description& visibleDesc, boost::program_options::options_description& hiddenDesc) const; @@ -46,4 +45,4 @@ public: } -#endif /* REPLCOMMAND_H */ +#endif /* CONSOLECOMMAND_H */