class Term::Prompt::Expander
- Term::Prompt::Expander
- Reference
- Object
Overview
A class responsible for rendering expanding options
Used by Prompt
to display key options question.
Defined in:
prompt/expander.crConstant Summary
-
HELP_CHOICE =
{key: "h", name: "print help", value: "help"}
Constructors
-
.new(prompt : Term::Prompt, prefix : String = prompt.prefix, default : Int32 = 1, auto_hint : Bool = false, palette : Term::Prompt::Palette = prompt.palette)
Create instance of Expander
Instance Method Summary
- #auto_hint : Bool
-
#call(message : Nil | String, possibilities, &block : self -> )
Execute this prompt
-
#call(message, possibilities)
ditto
-
#choice(*args, **kwargs)
Add a single choice
-
#choices
Get choices
-
#choices(*values)
Add choices
- #collapsed?
-
#default(value : Int32 = (not_set = true))
Set default value.
- #default_key : Bool
- #done : Bool
- #expand
- #expanded?
- #hint : String | Nil
-
#keyenter
Respond to submit event
-
#keypress(key, event)
Respond to key press event
- #keyreturn
- #palette : Prompt::Palette
- #prefix : String
- #question : String | Nil
- #read_input
-
#select_choice(key)
Select choice by given key
- #selected : Choice | Nil
- #status : Expander::Status
Constructor Detail
def self.new(prompt : Term::Prompt, prefix : String = prompt.prefix, default : Int32 = 1, auto_hint : Bool = false, palette : Term::Prompt::Palette = prompt.palette)
#
Create instance of Expander