diff --git a/src/command.h b/src/command.h index 1fdc14e..77fbee2 100644 --- a/src/command.h +++ b/src/command.h @@ -44,7 +44,14 @@ public: std::string getHelpAsString() { std::string help = ""; - for (auto &commandInfo : this->commands) + + std::list 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"; }