diff --git a/src/tui/CommandManager.cpp b/src/tui/CommandManager.cpp index 886ac269..685b1eab 100644 --- a/src/tui/CommandManager.cpp +++ b/src/tui/CommandManager.cpp @@ -12,6 +12,7 @@ #include "Debug.h" // Debug::methods #include // std::random_device #include "Tags.h" +#include "GitVersion.h" CommandManager::CommandManager(CAvaraAppImpl *theApp) : itsApp(theApp) { @@ -106,6 +107,17 @@ CommandManager::CommandManager(CAvaraAppImpl *theApp) : itsApp(theApp) { "/dbg flag val <- sets debug flag to integer value", METHOD_TO_LAMBDA_VARGS(SetDebugFlag)); TextCommand::Register(cmd); + + cmd = new TextCommand("/info <- show build info", + [this](VectorOfArgs vargs) -> bool { + std::string infoString(GetOsName()); + infoString += " "; + itsApp->rosterWindow->SendRosterMessage(infoString); + itsApp->rosterWindow->SendRosterMessage(GIT_VERSION); + + return false; + }); + TextCommand::Register(cmd); } @@ -645,3 +657,19 @@ bool CommandManager::SetDebugFlag(VectorOfArgs vargs) { itsApp->AddMessageLine(os.str()); return true; } + +std::string CommandManager::GetOsName() { + #ifdef _WIN32 + return "Windows 32-bit"; + #elif _WIN64 + return "Windows 64-bit"; + #elif __APPLE__ || __MACH__ + return "Mac OSX"; + #elif __linux__ + return "Linux"; + #elif __unix || __unix__ + return "Unix"; + #else + return "Unknown OS"; + #endif +} diff --git a/src/tui/CommandManager.h b/src/tui/CommandManager.h index bbe918c3..e5fbf581 100644 --- a/src/tui/CommandManager.h +++ b/src/tui/CommandManager.h @@ -51,4 +51,5 @@ class CommandManager { // Coding helpers bool SetDebugFlag(VectorOfArgs); + std::string GetOsName(); };