CommandParser class

An ArgParser returned by CommandSet.addCommand that adds arguments to a single command.

Inheritance

Properties

args ArgumentSet
A list of all registered arguments. This interface is not guaranteed to be stable!
no setterinherited
command CommandDefinition
no setter
commandParsers Map<String, CommandParser>
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
info UsageInfo
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
usageContext UsageContext
finalinherited
usageGroups Set<UsageGroup>
A list of all registered usage groups. This interface is not guaranteed to be stable!
no setterinherited
usagePrinter UsagePrinter
finalinherited

Methods

addCommands<T>({required ValueParser<T> parser, ValuePrinter<T>? printer}) CommandSet<T>
Sets up this parser to parse subcommands.
inherited
addCommandsS() CommandSet<String>
Shorthand for addCommands for strings.
inherited
addFlag(String name, {String? description, UsageGroup? usageGroup, String? short, String? inverse, bool defaultValue = false, void onParse(bool value)?}) Arg<bool>
Adds a new boolean flag.
inherited
addMultiFlag<U>(String name, {String? description, UsageGroup? usageGroup, String? short, String? inverse, required U defaultValue, required Accumulator<bool, U> accumulator, void onParse(bool value)?}) Arg<U>
Adds a new boolean flag that can be passed multiple times.
inherited
addMultiOption<T, U>(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short, required U defaultValue, required ValueParser<T> parser, ValuePrinter<T>? printer, required Accumulator<T, U> accumulator}) Arg<U>
Adds a new option that can be passed multiple times.
inherited
addMultiOptionN<T, U>(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short, required ValueParser<T> parser, ValuePrinter<T>? printer, required Accumulator<T, U> accumulator}) Arg<U?>
Shorthand for addMultiOption with a default value of null.
inherited
addMultiOptionS<U>(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short, required U defaultValue, required Accumulator<String, U> accumulator}) Arg<U>
Shorthand for addMultiOption for strings.
inherited
addMultiOptionSN<U>(String name, {String? description, String? valueDescription, String? short, required Accumulator<String, U> accumulator}) Arg<U?>
Shorthand for addMultiOption for strings with a default value of null.
inherited
addMultiPositional<T, U>(String name, {String? description, UsageGroup? usageGroup, Requires<U>? requires, required ValueParser<T> parser, ValuePrinter<T>? printer, required Accumulator<T, U> accumulator, bool? noOptionsFollowing}) Arg<U>
Adds a new positional argument that can take multiple values.
inherited
addMultiPositionalS<U>(String name, {String? description, UsageGroup? usageGroup, Requires<U>? requires, required Accumulator<String, U> accumulator, bool? noOptionsFollowing}) Arg<U>
Shorthand for addMultiPositional for strings.
inherited
addOption<T>(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short, required T defaultValue, required ValueParser<T> parser, ValuePrinter<T>? printer}) Arg<T>
Adds a new option.
inherited
addOptionN<T>(String name, {String? description, UsageGroup? usageGroup, String? valueDescription, String? short, required ValueParser<T> parser, ValuePrinter<T>? printer}) Arg<T?>
Shorthand for addOption with a default value of null.
inherited
addOptionS(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short, required String defaultValue}) Arg<String>
Shorthand for addOption for strings.
inherited
addOptionSN(String name, {String? description, String? valueDescription, UsageGroup? usageGroup, String? short}) Arg<String?>
Shorthand for addOption for strings with a default value of null.
inherited
addPositional<T>(String name, {String? description, UsageGroup? usageGroup, Requires<T>? requires, required ValueParser<T> parser, ValuePrinter<T>? printer, bool? noOptionsFollowing}) Arg<T>
Adds a new positional argument.
inherited
addPositionalN<T>(String name, {String? description, UsageGroup? usageGroup, required ValueParser<T> parser, ValuePrinter<T?>? printer, bool? noOptionsFollowing}) Arg<T?>
Shorthand for addPositional with a default value of null.
inherited
addPositionalS(String name, {String? description, UsageGroup? usageGroup, Requires<String>? requires, bool? noOptionsFollowing}) Arg<String>
Shorthand for addPositional for strings.
inherited
addPositionalSN(String name, {String? description, UsageGroup? usageGroup, bool? noOptionsFollowing}) Arg<String?>
Shorthand for addPositional for strings with a default value of null.
inherited
createUsageGroup(String name) UsageGroup
Creates a new usage group with the given name.
inherited
findSelectedParser() ArgParser
Returns the farthest parser the user has selected (i.e. given mycommand subcommand1 subcommand2, returns the parser for subcommand2). This interface is not guaranteed to be stable!
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printUsage({StringSink? sink, bool showShortUsage = false}) → void
Prints the usage information using this parser's usagePrinter to the given sink. If showShortUsage is true, then the printed usage will only contain the "Usage:" line showing a brief summary of how to use this parser.
inherited
toString() String
A string representation of this object.
inherited

Operators

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