class Athena::Console::Input::ARGV

Overview

An ACON::Input::Interface based on ARGV.

Direct Known Subclasses

Defined in:

input/argv.cr

Constructors

Instance Method Summary

Instance methods inherited from class Athena::Console::Input

argument(name : String, type : T.class) : T forall T
argument(name : String) : String | Nil
argument
, arguments : ::Hash arguments, bind(definition : ACON::Input::Definition) : Nil bind, escape_token(token : String) : String escape_token, has_argument?(name : String) : Bool has_argument?, has_option?(name : String) : Bool has_option?, interactive=(interactive : Bool) interactive=, interactive? : Bool interactive?, option(name : String, type : T.class) : T forall T
option(name : String) : String | Nil
option
, options : ::Hash options, set_argument(name : String, value : _) : Nil set_argument, set_option(name : String, value : _) : Nil set_option, stream : IO | Nil stream, stream=(stream : IO | Nil) stream=, validate : Nil validate

Constructor methods inherited from class Athena::Console::Input

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

Instance methods inherited from module Athena::Console::Input::Streamable

stream : IO | Nil stream, stream=(stream : IO | Nil) stream=

Instance methods inherited from module Athena::Console::Input::Interface

argument(name : String, type : T.class) forall T
argument(name : String) : String | Nil
argument
, arguments : ::Hash arguments, bind(definition : ACON::Input::Definition) : Nil bind, first_argument : String | Nil first_argument, has_argument?(name : String) : Bool has_argument?, has_option?(name : String) : Bool has_option?, has_parameter?(*values : String, only_params : Bool = false) : Bool has_parameter?, interactive=(interactive : Bool) interactive=, interactive? : Bool interactive?, option(name : String, type : T.class) forall T
option(name : String) : String | Nil
option
, options : ::Hash options, parameter(value : String, default : _ = false, only_params : Bool = false) parameter, set_argument(name : String, value : _) : Nil set_argument, set_option(name : String, value : _) : Nil set_option, to_s(io : IO) : Nil to_s, validate : Nil validate

Constructor Detail

def self.new(tokens : Array(String) = ::ARGV, definition : ACON::Input::Definition | Nil = nil) #

[View source]
def self.new(*tokens : String) #

[View source]

Instance Method Detail

def first_argument : String | Nil #

Returns the first argument from the raw un-parsed input. Mainly used to get the command that should be executed. ameba:disable Metrics/CyclomaticComplexity


[View source]
def 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.


[View source]
def 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.


[View source]
def to_s(io : IO) : Nil #

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


[View source]