forked from cafeberry/cafeberry
major bug: when connecting to the server a second time, it gets softlocked and keeps repeating ticking connection A\n in debug logs until it times out.
50 lines
1.0 KiB
C++
50 lines
1.0 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "CliCommandHelp.h"
|
|
|
|
#include "../../ServerCliEngine.h"
|
|
#include "../../ServerCliRegistry.h"
|
|
#include "../../ServerCliParser.h"
|
|
|
|
namespace ServerRuntime
|
|
{
|
|
const char *CliCommandHelp::Name() const
|
|
{
|
|
return "help";
|
|
}
|
|
|
|
std::vector<std::string> CliCommandHelp::Aliases() const
|
|
{
|
|
std::vector<std::string> aliases;
|
|
aliases.push_back("?");
|
|
return aliases;
|
|
}
|
|
|
|
const char *CliCommandHelp::Usage() const
|
|
{
|
|
return "help";
|
|
}
|
|
|
|
const char *CliCommandHelp::Description() const
|
|
{
|
|
return "Show available server console commands.";
|
|
}
|
|
|
|
bool CliCommandHelp::Execute(const ServerCliParsedLine &line, ServerCliEngine *engine)
|
|
{
|
|
(void)line;
|
|
const std::vector<std::unique_ptr<IServerCliCommand>> &commands = engine->Registry().Commands();
|
|
engine->LogInfo("Available commands:");
|
|
for (size_t i = 0; i < commands.size(); ++i)
|
|
{
|
|
std::string row = " ";
|
|
row += commands[i]->Usage();
|
|
row += " - ";
|
|
row += commands[i]->Description();
|
|
engine->LogInfo(row);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|