config library

Classes

ArgParseResult<O extends OptionDefinition>
Represents the parsed result for a command / subcommand on a command line.
BoolParser
Parses a boolean value from a string.
CommandAliasesDefinition
CommandDefinition<O extends OptionDefinition>
CommandUsageDefinition
ComparableValueOption<V extends Comparable>
Base class for configuration options that support minimum and maximum range checking.
ConfigOptionBase<V>
Defines a configuration option that can be set from configuration sources.
ConfigParser
A backwards compatible parser for command args and configuration sources.
ConfigResults
A wrapper around a Configuration object that implements the ArgResults interface. This is returned by the ConfigParser.parse method.
ConfigSourceProvider<O extends OptionDefinition>
Provider of a ConfigurationSource that is dynamically based on the current configuration.
Configuration<O extends OptionDefinition>
A configuration object that holds the values for a set of configuration options.
ConfigurationBroker<O extends OptionDefinition>
Resolves configuration values dynamically and possibly from multiple sources.
ConfigurationParser
Parsers for various configuration data sources.
ConfigurationSource
A source of configuration values.
DateTimeOption
Date-time value configuration option.
DateTimeParser
Parses a date string into a DateTime object. Throws FormatException if parsing failed.
DirOption
Directory path configuration option.
DirParser
DurationOption
Duration value configuration option.
DurationParser
Parses a duration string into a Duration object.
EnumOption<E extends Enum>
Enum value configuration option.
EnumParser<E extends Enum>
Parses a string value into an enum value. Currently requires an exact, case-sensitive match.
FileOption
File path configuration option.
FileParser
FlagOption
Boolean value configuration option.
IntOption
Integer value configuration option.
IntParser
MapConfigSource
Simple ConfigurationSource adapter for a Map<String, String>.
MultiDomainConfigBroker<O extends OptionDefinition>
A ConfigurationBroker that combines configuration sources from multiple providers, called configuration domains.
MultiOption<T>
Multi-value configuration option.
MultiParser<T>
Parses a list of values from a comma-separated string.
MultiStringOption
Convenience class for multi-value configuration option for strings.
MutuallyExclusive
An option group for mutually exclusive options.
NewParsedArgs
OptionContentConfigProvider<O extends OptionDefinition<String>>
A ConfigSourceProvider that uses the value of an option as data source.
OptionDefinition<V>
Common interface to enable same treatment for ConfigOptionBase and option enums.
OptionGroup
An option group allows grouping options together under a common name, and optionally provide option value validation on the group as a whole.
OptionReceiver
OptionResolution<V>
Describes the resolution of a configuration option.
ParsedArgs
A proxy (wrapper) for the parsed command-line arguments for an individual command/subcommand.
ScanMode
StringOption
String value configuration option.
StringParser
ValueParser that returns the input string unchanged.
ValueParser<V>
A ValueParser converts a source string value to the specific option value type.

Enums

ConfigEncoding
Encoding format of a configuration data source.
DoubleDashHandling
DurationUnit
The time units supported by the DurationParser.
MutuallyExclusiveMode
PathExistMode
ValueSourceType
The type of source that an option's value was resolved from.

Extensions

PrepareOptions on Iterable<OptionDefinition>
QualifiedString on OptionDefinition
Extension to add a qualifiedString shorthand method to OptionDefinition. Since enum classes that implement OptionDefinition don't inherit its method implementations, this extension provides this method implementation instead.

Constants

unknownSubcommandErrorPrefix → const String
The start of the ArgParseResult.errors message recorded when a word is not a known subcommand of a command that has subcommands.

Functions

addOptionsToReceiver(Iterable<OptionDefinition> argNameOpts, OptionReceiver receiver, {bool addGroupSeparators = false}) → void
Adds argNameOpts to argParser.
formatConfigError(String error) → String
Formats a configuration error message.
legacyParsedArgs(List<OptionDefinition> options, Iterable<String> args, {bool allowTrailingOptions = false}) → OldParsedArgs
Throws FormatException from ArgParser.parse if the argument parsing fails.
legacyParsedArgsFromArgResults(ArgResults argResults) → OldParsedArgs
newParsedArgs(Iterable<OptionDefinition> options, Iterable<String> args) → NewParsedArgs
optionAwaitingValue(String arg) → String?
If arg is written as an option that would take its value from the next argument, returns the spelling of that option: --name for a long option or -x for a short option (the last one of a cluster such as -abx).
prepareOptionsForParsing(Iterable<OptionDefinition> options, ArgParser argParser) → void
Validates and prepares a set of options for a legacy ArgParser.
scanAndParseArgs<O extends OptionDefinition>(Iterable<String> args, {required Iterable<O> options, ScanMode scanMode = const ScanMode()}) → ArgParseResult<O>
Scans the arguments and parses them into an ArgParseResult corresponding to a single set of options.
scanAndParseCommands<O extends OptionDefinition>(Iterable<String> args, {required CommandDefinition<O> rootCommand, ScanMode scanMode = const ScanMode()}) → ArgParseResult<O>
Scans the arguments and parses them into an ArgParseResult, treating the args as a command line potentially containing subcommands.
validateOptions(Iterable<OptionDefinition> options) → List<OptionDefinition>
Validates a set of options.

Exceptions / Errors

CommandDefinitionError
Indicates that the command definition is invalid.
ConfigDefinitionError
InvalidParseStateError
Specialized StateError that indicates that the configuration has not been successfully parsed and this prevents accessing some or all of the configuration values.
InvalidValueException
Indicates that the value of an option is invalid. Used by option implementations: Thrown by ConfigOptionBase.validateValue when a value is invalid. Not normally thrown to package users, it gets converted to UsageException.
OptionDefinitionError
Indicates that the option definition is invalid.
UsageException