HelpCommand<T> class
Standard built-in help command.
This command is hidden (not shown in the help output) but automatically
added as subcommand to all commands that have subcommands.
This enables the syntax help build for all commands in the command tree.
When specified last on the command line it will show the help for the prior
command, e.g. build help. By extending this class and overriding run
this help output can be customized. Some command systems provide a more
extensive user guide when help is specified last in this way.
- Inheritance
-
- Object
- Command<
OptionDefinition, T> - HelpCommand
- Implemented types
Constructors
Properties
- acceptsPartialCommandLine → bool
-
Help is shown for partial command lines, e.g. when the preceding
command is missing mandatory options or a subcommand.
no setter
- aliasesDefinition → CommandAliasesDefinition
-
Returns the aliases definition this command was constructed with, or the
default blank one.
Override this method to provide a dynamic aliases definition.
no setterinherited
- canRunAsLeafCommand → bool
-
Whether this command can be run as the last command on the command line
even if it has subcommands registered. Default is false.
If false and this command is the last command found on the command line,
the command line parser will yield an error.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasParent → bool
-
no setterinherited
- ignoreUnexpectedPositionalArgs → bool
-
Whether additional positional arguments (that don't match the defined
positional options) are allowed after this command. Defaults to false.
no setterinherited
- name → String
-
The name of this command.
final
-
options
→ List<
OptionDefinition> -
finalinherited
-
parent
↔ AbstractCommand<
OptionDefinition, T> -
Notionally protected; may only be called once.
Throws a StateError if this command already has a parent.
getter/setter pairinherited
- passThroughArgs → bool
-
Whether every argument after this command is left unparsed, to be
passed through to another program. Defaults to false.
no setterinherited
-
persistentOptions
→ List<
OptionDefinition> -
finalinherited
-
runner
→ CommandRunner<
OptionDefinition, T> -
Convenience method to get the root CommandRunner from any command.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subcommands
→ List<
Command< OptionDefinition, T> > -
The sibling commands of this help command, i.e. the commands it can
show help for (including itself, i.e.
help help), wrapped so thathelp <command>shows usage.no setter - usage → String
-
Generates a formatted string with usage information for this command.
no setterinherited
- usageDefinition → CommandUsageDefinition
-
Returns the usage definition this command was constructed with, or the
default blank one.
Override this method to provide a dynamic usage definition.
no setterinherited
- usageGenerator → UsageGenerator
-
The usage string generator for this command.
finalinherited
Methods
-
addMiddleware(
Middleware< FutureOr< middleware) → voidT?> , CommandContext<OptionDefinition, T> > -
Adds a middleware to this command.
Middlewares are invoked in the order they are added.
inherited
-
addOption(
OptionDefinition option, {bool? persistent}) → void -
Adds an option to this command.
persistentindicates whether the option should be persistent across this command's subcommands.inherited -
addSubcommand(
Command< OptionDefinition, T> subcommand) → void -
Adds a subcommand to this command.
inherited
-
allOptions(
{bool onlyPersistent = false}) → List< OptionDefinition> -
All the defined options of this command, depending on the passed flag.
inherited
-
completePassThroughArgs(
CommandContext< OptionDefinition, T> context, List<String> words) → FutureOr<CompletionResponse> -
Completes the arguments of this pass-through command, see
passThroughArgs.inherited -
configBroker(
CommandContext< OptionDefinition, T> ? prevContext) → ConfigurationBroker<OptionDefinition> ? -
Provides the configuration broker for resolving the configuration for this
command, if any.
prevContextand its predecessor contexts are the resolved contexts of the parent commands.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveCmd(
ArgParseResult< OptionDefinition> parseResult, Map<String, String> ? env, ContextProvider provider, CommandContext<OptionDefinition, T> ? prevContext, {required CommandRunMode runMode}) → CommandContext<OptionDefinition, T> -
Given a parsed command line, environmnent variables, a context provider,
and the resolved command contexts of the parent commands,
resolves the configuration for this command and returns a CommandContext
for it.
inherited
-
run(
CommandContext< OptionDefinition, dynamic> context) → FutureOr<T?> -
Runs this command as a leaf command. Implemented by subclasses.
override
-
runAsLeaf(
CommandContext< OptionDefinition, T> context) → FutureOr<T?> -
Runs this command as a leaf command.
inherited
-
runCommand(
CommandContext< OptionDefinition, T> context, {CommandHandler<OptionDefinition, T> ? runNextCommand}) → FutureOr<T?> -
Runs this command, including its middlewares (hooks).
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited