class Term::Prompt::List
- Term::Prompt::List
- Reference
- Object
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.crConstant 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
-
.new(prompt : Term::Prompt, **options)
Create instance of TTY::Prompt::List menu.
Instance Method Summary
-
#arrows_help
Information about arrow keys
-
#call(question : Nil | String, possibilities, &block : List -> )
Call the list menu by passing question and choices
- #call(question, possibilities)
-
#choice(*args, **kwargs)
Add a single choice
-
#choices
Get choices
-
#choices(*values)
Add choices
- #default
-
#default=(value)
Set default option selected
-
#default_help
Default help text
-
#enumerate?
Check if list is enumerated
- #help
- #help=(help : String | Nil)
- #keybackspace
- #keydelete
- #keydown
- #keyleft
- #keynum(key)
- #keypress(key, event)
- #keyreturn
-
#keyright
Moves all choices page by page keeping the current selected item at the same level on each page.
- #keyup
- #page_size : Int32
- #page_size=(page_size : Int32)
-
#paginated?
Check if list is paginated
-
#paginator
Select paginator based on the current navigation key
- #search_choice_in(searchable)
- #separator : String | Nil
- #separator=(separator : String | Nil)
- #symbols : Hash(Symbol, String)
- #symbols=(symbols : Hash(Symbol, String))
-
#sync_paginators
Synchronize paginators start positions
Constructor Detail
Instance Method Detail
Call the list menu by passing question and choices
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.