From 9be3ee1a1afd3237b466240119f338e2a6925253 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 7 Aug 2018 18:44:08 +0200 Subject: [PATCH] Update output for `--version` This moves the system and build information before the application paths which are normally not that important. --- lib/base/application.cpp | 38 +++++++++++++++------------------ lib/cli/troubleshootcommand.cpp | 4 ++-- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 0e6b018f2..bc8ec1bd4 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -538,27 +538,35 @@ String Application::GetExePath(const String& argv0) */ void Application::DisplayInfoMessage(std::ostream& os, bool skipVersion) { - os << "Application information:" << "\n"; - + /* icinga-app prints its own version information, stack traces need it here. */ if (!skipVersion) - os << " Application version: " << GetAppVersion() << "\n"; + os << " Application version: " << GetAppVersion() << "\n\n"; + + os << "System information:\n" + << " Platform: " << Utility::GetPlatformName() << "\n" + << " Platform version: " << Utility::GetPlatformVersion() << "\n" + << " Kernel: " << Utility::GetPlatformKernel() << "\n" + << " Kernel version: " << Utility::GetPlatformKernelVersion() << "\n" + << " Architecture: " << Utility::GetPlatformArchitecture() << "\n"; + + os << "\nBuild information:\n" + << " Compiler: " << ScriptGlobal::Get("BuildCompilerName") << " " << ScriptGlobal::Get("BuildCompilerVersion") << "\n" + << " Build host: " << ScriptGlobal::Get("BuildHostName") << "\n"; - os - << "\n" + os << "\nApplication information:\n" + << "\nGeneral paths:\n" << " Config directory: " << GetConst("ConfigDir") << "\n" << " Data directory: " << GetConst("DataDir") << "\n" << " Log directory: " << GetConst("LogDir") << "\n" << " Cache directory: " << GetConst("CacheDir") << "\n" << " Spool directory: " << GetConst("SpoolDir") << "\n" << " Run directory: " << GetConst("InitRunDir") << "\n" - << "\n" - << "Older paths (deprecated):" << "\n" + << "\nOld paths (deprecated):\n" << " Installation root: " << GetConst("PrefixDir") << "\n" << " Sysconf directory: " << GetConst("SysconfDir") << "\n" << " Run directory (base): " << GetConst("RunDir") << "\n" << " Local state directory: " << GetConst("LocalStateDir") << "\n" - << "\n" - << "Internally used paths:" << "\n" + << "\nInternal paths:\n" << " Package data directory: " << GetConst("PkgDataDir") << "\n" << " State path: " << GetConst("StatePath") << "\n" << " Modified attributes path: " << GetConst("ModAttrPath") << "\n" @@ -566,18 +574,6 @@ void Application::DisplayInfoMessage(std::ostream& os, bool skipVersion) << " Vars path: " << GetConst("VarsPath") << "\n" << " PID path: " << GetConst("PidPath") << "\n"; - os << "\n" - << "System information:" << "\n" - << " Platform: " << Utility::GetPlatformName() << "\n" - << " Platform version: " << Utility::GetPlatformVersion() << "\n" - << " Kernel: " << Utility::GetPlatformKernel() << "\n" - << " Kernel version: " << Utility::GetPlatformKernelVersion() << "\n" - << " Architecture: " << Utility::GetPlatformArchitecture() << "\n"; - - os << "\n" - << "Build information:" << "\n" - << " Compiler: " << ScriptGlobal::Get("BuildCompilerName") << " " << ScriptGlobal::Get("BuildCompilerVersion") << "\n" - << " Build host: " << ScriptGlobal::Get("BuildHostName") << "\n"; } /** diff --git a/lib/cli/troubleshootcommand.cpp b/lib/cli/troubleshootcommand.cpp index 6c72e1426..2770b5588 100644 --- a/lib/cli/troubleshootcommand.cpp +++ b/lib/cli/troubleshootcommand.cpp @@ -155,13 +155,13 @@ bool TroubleshootCommand::GeneralInfo(InfoLog& log, const boost::program_options << "\tCache directory: " << Application::GetConst("CacheDir") << "\n" << "\tRun directory: " << Application::GetConst("InitRunDir") << "\n" << "\t\n" - << "Older paths (deprecated):" << "\n" + << "Old paths (deprecated):\n" << "\tInstallation root: " << Application::GetConst("PrefixDir") << '\n' << "\tSysconf directory: " << Application::GetConst("SysconfDir") << '\n' << "\tRun directory: " << Application::GetConst("RunDir") << '\n' << "\tLocal state directory: " << Application::GetConst("LocalStateDir") << '\n' << "\t\n" - << "Internally used paths:" << "\n" + << "Internal paths:\n" << "\tPackage data directory: " << Application::GetConst("PkgDataDir") << '\n' << "\tState path: " << Application::GetConst("StatePath") << '\n' << "\tObjects path: " << Application::GetConst("ObjectsPath") << '\n' -- 2.40.0