Class: Clack::Prompts::SelectKey
- Inherits:
-
Core::Prompt
- Object
- Core::Prompt
- Clack::Prompts::SelectKey
- Defined in:
- lib/clack/prompts/select_key.rb
Overview
Quick selection via keyboard shortcuts.
Each option has an associated key. Pressing that key immediately selects the option and submits.
Options format:
-
‘{ value: “x”, label: “Do X”, key: “x” }` - explicit key
-
‘{ value: “create”, label: “Create” }` - key defaults to first char
Constant Summary
Constants inherited from Core::Prompt
Core::Prompt::MIN_TERMINAL_WIDTH
Instance Attribute Summary
Attributes inherited from Core::Prompt
#error_message, #state, #value, #warning_message
Instance Method Summary collapse
-
#initialize(message:, options:, **opts) ⇒ SelectKey
constructor
A new instance of SelectKey.
Methods inherited from Core::Prompt
flush_resize, register, #request_redraw, #run, setup_signal_handler, unregister
Constructor Details
#initialize(message:, options:, **opts) ⇒ SelectKey
Returns a new instance of SelectKey.
28 29 30 31 |
# File 'lib/clack/prompts/select_key.rb', line 28 def initialize(message:, options:, **opts) super(message:, **opts) @options = () end |