Option.fromString

Creates an option from a formatted string.

Format may include short name -x and/or long name --name, followed by parameter in <> (required) or [] (optional). Example: "-o, --output <file>".

class Option
static @safe
fromString
(
string format
,,
string defaultValue = null
)

Parameters

format string

Formatted string.

description string

Description of the option.

defaultValue string

Default value of the parameter, or null.

Throws

AssertionError if format does not contain 2 or 3 parts, or if parameter part is not enclosed in <> or [].