completions property
A collection of MapEntry with completion suggestions to their descriptions.
Implementation
@override
Map<String, String?> get completions {
final mapCompletions = <String, String>{};
for (final command in completionLevel.visibleSubcommands) {
final description = command.description;
if (command.name.startsWith(pattern)) {
mapCompletions[command.name] = description;
} else {
for (final alias in command.aliases) {
if (alias.startsWith(pattern)) {
mapCompletions[alias] = description;
}
}
}
}
return mapCompletions;
}