completions property
A collection of MapEntry with completion suggestions to their descriptions.
Implementation
@override
Map<String, String?> get completions {
final Option? option;
if (isAbbr) {
option = completionLevel.grammar.findByAbbreviation(optionName);
} else {
option = completionLevel.grammar.findByNameOrAlias(optionName);
}
final allowed = option?.allowed ?? [];
Iterable<String> filteredAllowed;
if (pattern == null) {
filteredAllowed = allowed;
} else {
filteredAllowed = allowed.where((e) => e.startsWith(pattern!));
}
return {
for (final allowed in filteredAllowed)
if (includeAbbrName)
'-$optionName$allowed': option?.allowedHelp?[allowed]
else
allowed: option?.allowedHelp?[allowed],
};
}