Command<T> class abstract

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.

Implementers

Constructors

Command()

Properties

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

Methods

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

Operators

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