class Athena::Console::Input::Option
- Athena::Console::Input::Option
- Reference
- Object
Overview
Represents a value (or array of ) provided to a command as optional un-ordered flags that be setup to accept a value, or represent a boolean flag. Options can also have an optional shortcut, default value, and/or description.
Options are specified with two dashes, or one dash when using the shortcut.
For example, ./console test --yell --dir=src -v
.
We have one option representing a boolean value, providing a value to another, and using the shortcut of another.
Options can be added via the ACON::Command#option
method,
or by instantiating one manually as part of an ACON::Input::Definition
.
The value of the option could then be accessed via one of the ACON::Input::Interface#option
overloads.
See ACON::Input::Interface
for more examples on how arguments/options are parsed, and how they can be accessed.
Defined in:
input/option.crConstructors
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#accepts_value? : Bool
Returns
true
ifself
is able to accept a value, otherwisefalse
. -
#complete(input : ACON::Completion::Input, suggestions : ACON::Completion::Suggestions) : Nil
Determines what values should be added to the possible suggestions based on the provided input.
-
#default(type : T.class) : T forall T
Returns the default value of
self
, if any, converted to the provided type. -
#default
Returns the default value of
self
, if any. -
#default=(default = nil) : Nil
Sets the default value of
self
. -
#description : String
Returns the description of
self
. -
#has_completion? : Bool
Returns
true
if this option is able to suggest values, otherwisefalse
-
#is_array? : Bool
Returns
true
ifself
is a required argument, otherwisefalse
. -
#name : String
Returns the name of
self
. -
#negatable? : Bool
Returns
true
ifself
is negatable, otherwisefalse
. -
#shortcut : String | Nil
Returns the shortcut of
self
, if any. -
#value_mode : ACON::Input::Option::Value
Returns the
ACON::Input::Option::Value
ofself
. -
#value_optional? : Bool
Returns
true
ifself
accepts a value but is optional, otherwisefalse
. -
#value_required? : Bool
Returns
true
ifself
accepts a value and it is required, otherwisefalse
.
Constructor Detail
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Determines what values should be added to the possible suggestions based on the provided input.
Returns the default value of self
, if any, converted to the provided type.
Returns true
if self
is a required argument, otherwise false
.
ameba:disable Naming/PredicateName
Returns true
if self
accepts a value and it is required, otherwise false
.