CliRejectionKind enum

Every way a router can fail to resolve an invocation, per spec 8.5. The router only classifies; it never maps a kind to an exit code, that is an application (SDK) concern.

Inheritance
Available extensions

Values

unknownCommand → const CliRejectionKind

The very first token does not match any literal route and the router has no parameter route to absorb it.

CliRejection.token is always the unmatched word. CliRejection.argument is always null: no positional is implicated, the invocation never reached one. CliRejection.option is always null and CliRejection.candidates is always empty: no option is implicated either.

extraArgument → const CliRejectionKind

A resolved route was reached, but a leftover token does not fit anywhere in it.

CliRejection.token is always the leftover token. CliRejection.argument is always null: the token is unexpected, not bound to a declared positional name. CliRejection.option is always null and CliRejection.candidates is always empty.

incomplete → const CliRejectionKind

The invocation ends, or a token fits nothing, at a node that is not itself a route and has no pending required parameter.

CliRejection.token is the token that did not continue the command when one caused the rejection, but null when argv simply ran out at a node that has no route of its own and no pending parameter (there is no offending token to name). CliRejection.argument is always null. CliRejection.option is always null and CliRejection.candidates is always empty: no option is implicated either way.

missingArgument → const CliRejectionKind

The invocation ends at a node that still needs a required parameter.

CliRejection.argument is always the missing positional's name. CliRejection.token is always null: this only happens when argv has run out, so there is no offending token. CliRejection.option is always null and CliRejection.candidates is always empty: no option is implicated.

unknownOption → const CliRejectionKind

The token is option shaped but declared nowhere reachable.

CliRejection.token is always the option exactly as written on argv. CliRejection.argument is always null.

CliRejection.option is non-null only when the token was actually read and matched a declared OptionSpec in scope during resolution, but that spec turned out not to be accepted by the route the invocation went on to resolve to (an option can be in scope while resolution is still underway, yet rejected once the exact route is known). It is null when the token never matched any declared option reachable from where it was read at all: a truly unrecognized spelling has no OptionSpec to report. CliRejection.candidates is always empty.

misplacedOption → const CliRejectionKind

The option is declared, but not here: it belongs to route words or an operand that have not been consumed yet.

CliRejection.token is always the misplaced option exactly as written on argv (or '--' itself, for a -- that follows an operand). CliRejection.argument is always null.

CliRejection.option is non-null only when the router can name the one declared OptionSpec the token matches: reading an already known option immediately ahead of a literal route word, or every route still reachable from here declaring the token with the very same shape (even when more than one such route remains reachable: they all agree, so the shared shape can still be named). It is null for a -- that follows an operand (not an option at all), for an option read after an operand has already started (its declaration is not looked up before the rejection fires, regardless of whether the token happens to be declared somewhere), and when several routes still reachable from here declare the token with genuinely different shapes (no single shape can be reported).

CliRejection.candidates tracks route ambiguity, and is populated independently of whether CliRejection.option is null: it is non-empty whenever more than one route is still reachable from here and no single one of them can be identified as the route this rejection belongs to, every such route, in trie declaration order, whether or not their option shapes agree. That covers both the shapes-agree situation just above (CliRejection.option is then non-null: the shared shape) and the genuinely-differing-shapes situation (CliRejection.option is then null). It is empty for every other cause of misplacedOption, including when exactly one candidate was found or a lookahead singled one out (then CliRejection.route already names it and CliRejection.option, when matched, already names its shape, so the list would be redundant).

missingValue → const CliRejectionKind

A value option has no value: it is the last token, or the next token is option shaped.

CliRejection.token is always the option missing its value, exactly as written on argv. CliRejection.argument is always null. CliRejection.option is always the OptionSpec missing its value. CliRejection.candidates is always empty.

unexpectedValue → const CliRejectionKind

A flag was given a value (--flag=x); flags never take one.

CliRejection.token is always the flag with its attached value, exactly as written on argv. CliRejection.argument is always null. CliRejection.option is always the flag's own OptionSpec. CliRejection.candidates is always empty.

invalidShortOption → const CliRejectionKind

A single-dash token is not exactly one letter (-qh, -f=v, -fv).

CliRejection.token is always the malformed token exactly as written on argv. CliRejection.argument is always null. CliRejection.option is always null: the token never parses far enough to be matched against any declared OptionSpec. CliRejection.candidates is always empty.

repeatedOption → const CliRejectionKind

A non-repeatable option occurred more than once, under any spelling.

CliRejection.token is always the repeated occurrence exactly as written on argv (not the first one). CliRejection.argument is always null. CliRejection.option is always the repeated OptionSpec. CliRejection.candidates is always empty.

missingRequiredOption → const CliRejectionKind

A required option was never read, decided only after every option on the invocation was read.

Neither CliRejection.argument nor CliRejection.token applies: the rejection is structural (an option that never showed up at all), not tied to one specific argv token or positional. Both are always null.

CliRejection.option is always the required OptionSpec that was never read: a route-local option, or, when the route accepts globals, possibly one of the router's own global options instead. Only the first missing option found is reported (spec order), even when more than one is missing. CliRejection.candidates is always empty.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Constants

values → const List<CliRejectionKind>
A constant List of the values in this enum, in order of their declaration.