class

Athena::Console::Input

Inherits Athena::Console::Input::Streamable / Athena::Console::Input::Interface / Reference / Object

Common base implementation of ACON::Input::Interface.

Constructors

new(definition : ACON::Input::Definition | Nil = nil)
Source

Instance methods

argument(name : String, type : T.class) : T forall T

Returns the value of the argument with the provided name converted to the desired type. This method is preferred over #argument since it provides better typing.

Raises an ACON::Exception::Logic if the actual argument value could not be converted to a type.

Source
argument(name : String) : String | Nil

Returns the raw string value of the argument with the provided name, or nil if is optional and was not provided.

Source
arguments

Returns a ::Hash representing the keys and values of the parsed arguments of self.

Source
bind(definition : ACON::Input::Definition) : Nil

Binds the provided definition to self. Essentially provides what should be parsed from self.

Source
escape_token(token : String) : String

Escapes a token via Process.quote if it contains unsafe characters.

Source
has_argument?(name : String) : Bool

Returns true if self has an argument with the provided name, otherwise false.

Source
has_option?(name : String) : Bool

Returns true if self has an option with the provided name, otherwise false.

Source
interactive=(interactive : Bool)

Sets if self is #interactive?.

Source
interactive?

Returns true if self represents an interactive input, such as a TTY.

Source
option(name : String, type : T.class) : T forall T

Returns the value of the option with the provided name converted to the desired type. This method is preferred over #option since it provides better typing.

Raises an ACON::Exception::Logic if the actual option value could not be converted to a type.

Source
option(name : String) : String | Nil

Returns the raw string value of the option with the provided name, or nil if is optional and was not provided.

Source
options

Returns a ::Hash representing the keys and values of the parsed options of self.

Source
set_argument(name : String, value : _) : Nil

Sets the value of the argument with the provided name.

Source
set_option(name : String, value : _) : Nil

Sets the value of the option with the provided name.

Source
stream

Returns the input stream.

Source
stream=(stream : IO | Nil)

Sets the input stream.

Source
validate

Validates the input, asserting all of the required parameters are provided. Raises ACON::Exception::Runtime when not enough arguments are given.

Source

Nested types