completions property

  1. @override
Map<String, String?> get completions
override

A collection of MapEntry with completion suggestions to their descriptions.

Implementation

@override
Map<String, String?> get completions {
  final mapCompletions = <String, String?>{};
  for (final subcommand in completionLevel.visibleSubcommands) {
    mapCompletions[subcommand.name] = subcommand.description;
  }
  for (final option in completionLevel.visibleOptions) {
    mapCompletions['--${option.name}'] = option.help;
    if (option.negatable ?? false) {
      mapCompletions['--no-${option.name}'] = option.help;
    }
  }
  return mapCompletions;
}