complete method

Future<CompletionResponse> complete(
  1. List<String> words, {
  2. Map<String, String> environment = const {},
  3. ContextProvider? provider,
})

Completes the last of words, the (possibly empty) word being typed, given the preceding words on the command line.

words does not include the executable name.

environment is passed to resolver, when one is given, and to custom ConfigOptionBase.complete implementations as CompletionContext.environment.

provider is passed to resolver when an option value is completed, so configuration brokers and middleware see objects seeded on it. When omitted, an empty provider is used.

Implementation

Future<CompletionResponse> complete(
  final List<String> words, {
  final Map<String, String> environment = const {},
  final ContextProvider? provider,
}) async {
  try {
    return await _complete(words, environment, provider);
  } catch (e, s) {
    onError?.call(e, s);
    return const CompletionResponse.error();
  }
}