Module: Verto::CliHelpers

Defined in:
lib/verto/utils/cli_helpers.rb

Class Method Summary collapse

Class Method Details

.confirm(text) ⇒ Object



6
7
8
# File 'lib/verto/utils/cli_helpers.rb', line 6

def confirm(text)
  shell_basic.yes?("#{text} (y/n)")
end

.edit_text(text) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/verto/utils/cli_helpers.rb', line 14

def edit_text(text)
  tempfile = "/tmp/verto-changelog-edit-#{SecureRandom.hex}"

  TTY::Editor.open(tempfile, text: text)

  edited_text = File.read(tempfile)

  File.delete(tempfile)

  edited_text
end

.select_options(question, choices) ⇒ Object



10
11
12
# File 'lib/verto/utils/cli_helpers.rb', line 10

def select_options(question, choices)
  tty_prompt.expand(question, choices)
end