Skip to content

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.

NEGATABLE = 8#

Similar to NONE, but also accepts its negation. E.g. --yell or --no-yell.

None = 0#

All = 15#

Methods#

#accepts_value? : Bool#

View source

#is_array?#

View source

#negatable?#

View source

#none?#

View source

#optional?#

View source

#required?#

View source