class Term::Prompt::List

Overview

A class responsible for rendering select list menu Used by {Prompt} to display interactive menu.

@api private

Direct Known Subclasses

Defined in:

prompt/list.cr

Constant Summary

FILTER_KEYS_MATCHER = /\A([[:alnum:]]|[[:punct:]])\Z/

Allowed keys for filter, along with backspace and canc.

HELP = "(Use %s arrow%s keys, press Enter to select%s)"

Constructors

Instance Method Summary

Constructor Detail

def self.new(prompt : Term::Prompt, **options) #

Create instance of TTY::Prompt::List menu.


[View source]

Instance Method Detail

def arrows_help #

Information about arrow keys


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

Call the list menu by passing question and choices


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

[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 default #

[View source]
def default=(value) #

Set default option selected


[View source]
def default_help #

Default help text


[View source]
def enumerate? #

Check if list is enumerated


[View source]
def help #

[View source]
def help=(help : String | Nil) #

[View source]
def keybackspace #

[View source]
def keydelete #

[View source]
def keydown #

[View source]
def keyleft #

[View source]
def keynum(key) #

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

[View source]
def keyreturn #

[View source]
def keyright #

Moves all choices page by page keeping the current selected item at the same level on each page.

When the choice on a page is outside of next page range then adjust it to the last item, otherwise leave unchanged.


[View source]
def keyup #

[View source]
def page_size : Int32 #

[View source]
def page_size=(page_size : Int32) #

[View source]
def paginated? #

Check if list is paginated


[View source]
def paginator #

Select paginator based on the current navigation key


[View source]
def search_choice_in(searchable) #

[View source]
def separator : String | Nil #

[View source]
def separator=(separator : String | Nil) #

[View source]
def symbols : Hash(Symbol, String) #

[View source]
def symbols=(symbols : Hash(Symbol, String)) #

[View source]
def sync_paginators #

Synchronize paginators start positions


[View source]