Module: TTYPromptHelper

Included in:
Devlogs::CLI, IssueManager
Defined in:
lib/devlogs/helper/tty_prompt_helper.rb

Overview

Utility module for tty-prompt library

Defined Under Namespace

Modules: Validator

Instance Method Summary collapse

Instance Method Details

#build_select_prompt(data:, text:) ⇒ Object

Builds a basic select prompt using the provided data

Parameters:

  • data (Array<String>)


16
17
18
19
20
21
22
23
24
# File 'lib/devlogs/helper/tty_prompt_helper.rb', line 16

def build_select_prompt(data:, text:)
  ttyprompt = TTY::Prompt.new

  ttyprompt.select(text) do |menu|
    data.each_with_index do |d, index|
      menu.choice d, index
    end
  end
end