Skip to content

Commit

Permalink
info chat command
Browse files Browse the repository at this point in the history
Chat command that displays platform and build in chat
  • Loading branch information
blenkush committed Aug 16, 2024
1 parent 4fe45e6 commit c19a43f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/tui/CommandManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Debug.h" // Debug::methods
#include <random> // std::random_device
#include "Tags.h"
#include "GitVersion.h"

CommandManager::CommandManager(CAvaraAppImpl *theApp) : itsApp(theApp) {

Expand Down Expand Up @@ -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);
}


Expand Down Expand Up @@ -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
}
1 change: 1 addition & 0 deletions src/tui/CommandManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ class CommandManager {

// Coding helpers
bool SetDebugFlag(VectorOfArgs);
std::string GetOsName();
};

0 comments on commit c19a43f

Please sign in to comment.