class Term::Prompt::Expander

Overview

A class responsible for rendering expanding options Used by Prompt to display key options question.

Defined in:

prompt/expander.cr

Constant Summary

HELP_CHOICE = {key: "h", name: "print help", value: "help"}

Constructors

Instance Method Summary

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


[View source]

Instance Method Detail

def auto_hint : Bool #

[View source]
def call(message : Nil | String, possibilities, &block : self -> ) #

Execute this prompt


[View source]
def call(message, possibilities) #

ditto


[View source]
def choice(*args, **kwargs) #

Add a single choice


[View source]
def choices #

Get choices


[View source]
def choices(*values) #

Add choices


[View source]
def collapsed? #

[View source]
def default(value : Int32 = (not_set = true)) #

Set default value.


[View source]
def default_key : Bool #

[View source]
def done : Bool #

[View source]
def expand #

[View source]
def expanded? #

[View source]
def hint : String | Nil #

[View source]
def keyenter #

Respond to submit event


[View source]
def keypress(key, event) #

Respond to key press event

@api public


[View source]
def keyreturn #

[View source]
def palette : Prompt::Palette #

[View source]
def prefix : String #

[View source]
def question : String | Nil #

[View source]
def read_input #

[View source]
def select_choice(key) #

Select choice by given key


[View source]
def selected : Choice | Nil #

[View source]
def status : Expander::Status #

[View source]