diff --git a/source/utils/config/ConfigUtils.cpp b/source/utils/config/ConfigUtils.cpp index 4816d56..a929e11 100644 --- a/source/utils/config/ConfigUtils.cpp +++ b/source/utils/config/ConfigUtils.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -123,6 +124,21 @@ void ConfigUtils::displayMenu() { configs.emplace_back(info, std::move(config)); } + // Sort Configs by name + std::sort( + configs.begin(), + configs.end(), + [](const ConfigDisplayItem &lhs, const ConfigDisplayItem &rhs) { + auto &str1 = lhs.getConfigInformation().name; + auto &str2 = rhs.getConfigInformation().name; + return lexicographical_compare( + begin(str1), end(str1), + begin(str2), end(str2), + [](const char &char1, const char &char2) { + return tolower(char1) < tolower(char2); + }); + }); + ConfigRenderer renderer(std::move(configs)); configs.clear();