diff --git a/src/command.hpp b/src/command.hpp index c3f0d2f..ca7b367 100644 --- a/src/command.hpp +++ b/src/command.hpp @@ -45,10 +45,17 @@ 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"; } + return help; }