CompletionEngine<O extends OptionDefinition, T> class

Computes the completion candidates for a partial command line, using the command tree and option definitions of a root command.

The partial command line is parsed with the regular argument parser, so the same rules apply as when running the command line: persistent options, option aliases and abbreviations, --option=value, --, etc.

The engine never throws; on any error it responds with CompletionDirective.error.

Constructors

CompletionEngine(CommandDefinition<O> rootCommand, {CommandResolver<O, T>? resolver, ParserSettings parserSettings = const ParserSettings(), void onError(Object error, StackTrace stackTrace)?})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
onError → void Function(Object error, StackTrace stackTrace)?
Receives a diagnostic message when a completion request fails.
final
parserSettings → ParserSettings
See CommandRunner.parserSettings.
final
resolver → CommandResolver<O, T>?
When set, option-value completion resolves the command line typed so far and runs that chain's middleware before asking the option for candidates. The same goes for the arguments of a pass-through command, which that command completes.
final
rootCommand → CommandDefinition<O>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

complete(List<String> words, {Map<String, String> environment = const {}, ContextProvider? provider}) → Future<CompletionResponse>
Completes the last of words, the (possibly empty) word being typed, given the preceding words on the command line.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited