enum Athena::Console::Input::Option::Value
#
Represents the possible vale types of an ACON::Input::Option
.
Value modes can also be combined using the Enum.[] macro.
For example, ACON::Input::Option::Value[:required, :is_array]
which defines a required array option.
Members#
NONE = 0
#
Represents a boolean flag option that will be true
if provided, otherwise false
.
E.g. --yell
.
REQUIRED = 1
#
Represents an option that MUST have a value if provided.
The option itself is still optional.
E.g. --dir=src
.
OPTIONAL = 2
#
Represents an option that MAY have a value, but it is not a requirement.
E.g. --yell
or --yell=loud
.
When using the option value mode, it can be hard to distinguish between passing an option without a value and not passing it at all.
In this case you should set the default of the option to false
, instead of the default of nil
.
Then you would be able to tell it wasn't passed by the value being false
, passed without a value as nil
, and passed with a value.
Note
In this context you will need to work with the raw String?
representation of the value due to the union of types the value could be.
IS_ARRAY = 4
#
Represents an option that can be provided multiple times to produce an array of values.
E.g. --dir=/foo --dir=/bar
.