class Athena::Console::Input::Argument
- Athena::Console::Input::Argument
- Reference
- Object
Overview
Represents a value (or array of values) provided to a command as a ordered positional argument, that can either be required or optional, optionally with a default value and/or description.
Arguments are strings separated by spaces that come after the command name.
For example, ./console test arg1 "Arg2 with spaces"
.
Arguments can be added via the ACON::Command#argument
method,
or by instantiating one manually as part of an ACON::Input::Definition
.
The value of the argument could then be accessed via one of the ACON::Input::Interface#argument
overloads.
See ACON::Input::Interface
for more examples on how arguments/options are parsed, and how they can be accessed.
Defined in:
input/argument.crConstructors
Instance Method Summary
-
#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)
Sets the default value of
self
. -
#description : String
Returns the description of
self
. -
#has_completion? : Bool
Returns
true
if this argument is able to suggest values, otherwisefalse
-
#is_array? : Bool
Returns
true
ifself
expects an array of values, otherwisefalse
. -
#mode : ACON::Input::Argument::Mode
Returns the
ACON::Input::Argument::Mode
ofself
. -
#name : String
Returns the name of the
self
. -
#required? : Bool
Returns
true
ifself
is a required argument, otherwisefalse
.
Constructor Detail
Instance Method Detail
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 this argument is able to suggest values, otherwise false
Returns true
if self
expects an array of values, otherwise false
.
ameba:disable Naming/PredicateName