class

Athena::Console::Input::Hash

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

An ACON::Input::Interface based on a Hash.

Primarily useful for manually invoking commands, or as part of tests.

ACON::Input::Hash.new(name: "George", "--foo": "bar")

The keys of the input should be the name of the argument. Options should have -- prefixed to their name.

Constructors

new(args : ::Hash = ::Hash(NoReturn, NoReturn).new, definition : ACON::Input::Definition | Nil = nil)
Source
new(args : Enumerable, definition : ACON::Input::Definition | Nil = nil)
Source
new(*args : _) : self
Source

Instance methods

first_argument

Returns the first argument from the raw un-parsed input. Mainly used to get the command that should be executed.

Source
has_parameter?(*values : String, only_params : Bool = false) : Bool

Returns true if the raw un-parsed input contains one of the provided values.

This method is to be used to introspect the input parameters before they have been validated. It must be used carefully. It does not necessarily return the correct result for short options when multiple flags are combined in the same option.

If only_params is true, only real parameters are checked. I.e. skipping those that come after the -- option.

Source
parameter(value : String, default : _ = false, only_params : Bool = false)

Returns the value of a raw un-parsed parameter for the provided value..

This method is to be used to introspect the input parameters before they have been validated. It must be used carefully. It does not necessarily return the correct result for short options when multiple flags are combined in the same option.

If only_params is true, only real parameters are checked. I.e. skipping those that come after the -- option.

Source
to_s(io : IO) : Nil

Returns a string representation of the args passed to the command.

Source