console: lambda append_csv per a generateConsoleHelp
This commit is contained in:
@@ -1275,12 +1275,17 @@ auto CommandRegistry::generateTerminalHelp() const -> std::string {
|
||||
return out.str();
|
||||
}
|
||||
|
||||
auto CommandRegistry::generateConsoleHelp() const -> std::string { // NOLINT(readability-function-cognitive-complexity)
|
||||
auto CommandRegistry::generateConsoleHelp() const -> std::string {
|
||||
// Agrupar comandos visibles por scope
|
||||
std::string global_cmds;
|
||||
std::string debug_cmds;
|
||||
std::string editor_cmds;
|
||||
|
||||
auto append_csv = [](std::string& dst, const std::string& token) {
|
||||
if (!dst.empty()) { dst += ", "; }
|
||||
dst += token;
|
||||
};
|
||||
|
||||
for (const auto& cmd : commands_) {
|
||||
if (cmd.help_hidden) { continue; }
|
||||
if (!isCommandVisible(cmd)) { continue; }
|
||||
@@ -1290,16 +1295,12 @@ auto CommandRegistry::generateConsoleHelp() const -> std::string { // NOLINT(re
|
||||
|
||||
// Clasificar por el PRIMER scope del comando
|
||||
const std::string& primary = cmd.scopes.empty() ? "global" : cmd.scopes[0];
|
||||
|
||||
if (primary == "editor") {
|
||||
if (!editor_cmds.empty()) { editor_cmds += ", "; }
|
||||
editor_cmds += kw_lower;
|
||||
append_csv(editor_cmds, kw_lower);
|
||||
} else if (primary == "debug") {
|
||||
if (!debug_cmds.empty()) { debug_cmds += ", "; }
|
||||
debug_cmds += kw_lower;
|
||||
append_csv(debug_cmds, kw_lower);
|
||||
} else {
|
||||
if (!global_cmds.empty()) { global_cmds += ", "; }
|
||||
global_cmds += kw_lower;
|
||||
append_csv(global_cmds, kw_lower);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user