suggestions static method
Returns close command names for an unknown name.
Implementation
static List<String> suggestions(String name) {
if (name.trim().isEmpty) return const [];
final normalized = name.toLowerCase();
final matches = <String>[];
for (final command in commands) {
final candidates = [command.name, ...command.aliases];
if (candidates.any(
(candidate) =>
candidate.startsWith(normalized) ||
normalized.startsWith(candidate) ||
_distance(candidate, normalized) <= 2,
)) {
matches.add(command.name);
}
}
matches.sort();
return matches.take(3).toList();
}