Class: BundleUpdateInteractive::CLI::MultiSelect::List
- Inherits:
-
TTY::Prompt::MultiList
- Object
- TTY::Prompt::MultiList
- BundleUpdateInteractive::CLI::MultiSelect::List
- Defined in:
- lib/bundle_update_interactive/cli/multi_select.rb
Instance Method Summary collapse
-
#initialize(prompt, **options) ⇒ List
constructor
A new instance of List.
- #keyctrl_a ⇒ Object
- #keyctrl_r ⇒ Object
- #keypress(event) ⇒ Object
- #reverse_selection ⇒ Object
-
#select_all ⇒ Object
Unregister tty-prompt’s default ctrl-a and ctrl-r bindings.
- #selected_names ⇒ Object
Constructor Details
#initialize(prompt, **options) ⇒ List
Returns a new instance of List.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 14 def initialize(prompt, **) @opener = .delete(:opener) defaults = { cycle: true, help_color: :itself.to_proc, per_page: [TTY::Prompt::Paginator::DEFAULT_PAGE_SIZE, TTY::Screen.height.to_i - 3].max, quiet: true, show_help: :always } super(prompt, **defaults.merge()) end |
Instance Method Details
#keyctrl_a ⇒ Object
33 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 33 def keyctrl_a(*); end |
#keyctrl_r ⇒ Object
34 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 34 def keyctrl_r(*); end |
#keypress(event) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 36 def keypress(event) case event.value when "k", "p" then keyup when "j", "n" then keydown when "a" then select_all when "r" then reverse_selection when "o" then opener&.call(choices[@active - 1].value) end end |
#reverse_selection ⇒ Object
32 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 32 alias reverse_selection keyctrl_r |
#select_all ⇒ Object
Unregister tty-prompt’s default ctrl-a and ctrl-r bindings
31 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 31 alias select_all keyctrl_a |
#selected_names ⇒ Object
26 27 28 |
# File 'lib/bundle_update_interactive/cli/multi_select.rb', line 26 def selected_names "" end |