Command<T> class

A single command.

A command is known as a "leaf command" if it has no subcommands and is meant to be run. Leaf commands must override run.

A command with subcommands is known as a "branch command" and cannot be run itself. It should call addSubcommand (often from the constructor) to register subcommands.

Constructors

Command()

Properties

aliases List<String>
Alternate names for this command. [...]
read-only
argParser ArgParser
The argument parser for this command. [...]
read-only
argResults ArgResults
The parsed argument results for this command. [...]
read-only
description String
A description of this command, included in usage.
read-only
globalResults ArgResults
The parsed global argument results. [...]
read-only
hidden bool
Whether or not this command should be hidden from help listings. [...]
read-only
invocation String
A single-line template for how to invoke this command (e.g. "pub getpackage").
read-only
name String
The name of this command.
read-only
parent Command<T>
The command's parent command, if this is a subcommand. [...]
read-only
runner CommandRunner<T>
The command runner for this command. [...]
read-only
subcommands Map<String, Command<T>>
An unmodifiable view of all sublevel commands of this command.
read-only
summary String
A short description of this command, included in parent's CommandRunner.usage. [...]
read-only
takesArguments bool
Whether or not this command takes positional arguments in addition to options. [...]
read-only
usage String
Generates a string displaying usage information for this command. [...]
read-only
usageFooter String
An optional footer for usage. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addSubcommand(Command<T> command) → void
Adds Command as a subcommand of this.
printUsage() → void
Prints the usage information for this command. [...]
run() FutureOr<T>
Runs this command. [...]
usageException(String message) → void
Throws a UsageException with message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited