CommandRunner<T> class
A class for invoking Commands based on raw command-line arguments.
The type argument T
represents the type returned by Command.run and
CommandRunner.run; it can be ommitted if you're not using the return
values.
Constructors
- CommandRunner(String executableName, String description, {int usageLineLength})
Properties
- argParser → ArgParser
-
The top-level argument parser. [...]
read-only
-
commands
→ Map<
String, Command< T> > -
An unmodifiable view of all top-level commands defined for this runner.
read-only
- description → String
-
A short description of this executable.
final
- executableName → String
-
The name of the executable being run. [...]
final
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- invocation → String
-
A single-line template for how to invoke this executable. [...]
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- usage → String
-
Generates a string displaying usage information for the executable. [...]
read-only
-
An optional footer for usage. [...]
read-only
Methods
-
addCommand(
Command< T> command) → void - Adds Command as a top-level command to this runner.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
parse(
Iterable< String> args) → ArgResults -
Parses
args
and returns the result, converting an ArgParserException to a UsageException. [...] -
printUsage(
) → void - Prints the usage information for this runner. [...]
-
run(
Iterable< String> args) → Future<T> -
Parses
args
and invokes Command.run on the chosen command. [...] -
runCommand(
ArgResults topLevelResults) → Future< T> -
Runs the command specified by
topLevelResults
. [...] -
toString(
) → String -
Returns a string representation of this object.
inherited
-
usageException(
String message) → void -
Throws a UsageException with
message
.
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited