class Athena::Console::Completion::Input
Overview
A specialization of ACON::Input::ARGV
that allows for unfinished name/values.
Exposes information about the name, type, and value of the value/name being completed.
Defined in:
completion/input.crConstructors
- .from_string(input : String, current_index : Int32) : self
- .from_tokens(tokens : Array(String), current_index : Int32) : self
Instance Method Summary
-
#bind(definition : ACON::Input::Definition) : Nil
:inherit:
-
#completion_name : String | Nil
Returns the name of the argument/option when completing a value.
-
#completion_type : ACON::Completion::Input::Type
Returns which [type][ACON::Completion::Input::Type] of completion is required.
-
#completion_value : String
Returns the value typed by the user, or empty string.
-
#must_suggest_argument_values_for?(argument_name : String) : Bool
Returns
true
if this input is able to suggest values for the provided argument_name. -
#must_suggest_values_for?(option_name : String) : Bool
Returns
true
if this input is able to suggest values for the provided option_name. -
#relevant_token : String
Returns the current token of the cursor, or last token if the cursor is at the end of the input.
Instance methods inherited from class Athena::Console::Input::ARGV
first_argument : String | Nil
first_argument,
has_parameter?(*values : String, only_params : Bool = false) : Bool
has_parameter?,
parameter(value : String, default : _ = false, only_params : Bool = false)
parameter,
to_s(io : IO) : Nil
to_s
Constructor methods inherited from class Athena::Console::Input::ARGV
new(tokens : Array(String) = ::ARGV, definition : ACON::Input::Definition | Nil = nil)new(*tokens : String) new
Instance methods inherited from class Athena::Console::Input
argument(name : String, type : T.class) : T forall Targument(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 Targument(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
Instance Method Detail
:inherit:
ameba:disable Metrics/CyclomaticComplexity
Returns the name of the argument/option when completing a value.
Returns which [type][ACON::Completion::Input::Type] of completion is required.
Returns true
if this input is able to suggest values for the provided argument_name.
Returns true
if this input is able to suggest values for the provided option_name.
Returns the current token of the cursor, or last token if the cursor is at the end of the input.