getAllHelp method
Get help for all visible commands, grouped by category.
Implementation
String getAllHelp() {
final buf = StringBuffer();
buf.writeln('Available commands:\n');
final byCategory = <CommandCategory, List<CommandRegistration>>{};
for (final reg in visible) {
byCategory.putIfAbsent(reg.category, () => []).add(reg);
}
for (final category in CommandCategory.values) {
final cmds = byCategory[category];
if (cmds == null || cmds.isEmpty) continue;
buf.writeln('${_categoryLabel(category)}:');
for (final reg in cmds) {
final aliases = reg.allAliases.isNotEmpty
? ' (${reg.allAliases.map((a) => "/$a").join(", ")})'
: '';
buf.writeln(' /${reg.name}$aliases — ${reg.command.description}');
}
buf.writeln();
}
return buf.toString();
}