sort command-order for help command

This commit is contained in:
lucaspalomodevelop 2023-10-07 12:53:24 +02:00
parent e3325b1bd3
commit 6589f344e4

View File

@ -44,7 +44,14 @@ public:
std::string getHelpAsString()
{
std::string help = "";
for (auto &commandInfo : this->commands)
std::list<commandInfo> sortedCommands = this->commands;
sortedCommands.sort([](const commandInfo &a, const commandInfo &b) {
return a.name < b.name;
});
for (auto &commandInfo : sortedCommands)
{
help += commandInfo.name + " - " + commandInfo.description + "\n";
}