Command class
An action, callable by a user of the command line environment.
Whenever building a cli application, you need an entry point for the functionality your app provides. To make an app more complex and flexible you can nest commands into superordinary ones. Therefore you command tree is the interface for the user of your application to prompt it's features.
Stepflow provides you this structure by it's Command.
Constructors
-
Command({required String use, required String description, required FutureOr<
Response> run(CommandInformation context), bool inheritFlags = false, List<Flag> flags = const [], List<Command> subCommands = const []}) - Instantiates a command with the given values. A command is an action, callable inside the cli.
Properties
- description → String
-
A short description of the command and
it's functionality for guidance and documentation.
final
-
flags
↔ List<
Flag> -
Flags available to the command.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
Whether the command is hidden from help listings.
final
- inheritFlags → bool
-
Whether this command inherits flags from a parent.
final
-
run
→ FutureOr<
Response> Function(CommandInformation context) -
Execution function invoked with the parsed context.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subCommands
→ List<
Command> -
Subcommands under this command.
final
- use → String
-
The name of this command.
Will be the usage in command line
and get's parsed of the arguments.
Maximal length of 15 characters.
final
Methods
-
formatSyntax(
{bool withFlags = true}) → String - Returns a help message describing the usage of the command and it's available flags.
-
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