Sha256: 46bec86cf50060c149d2510aee88b595a6dc926a6335a1b3ceb9025ddf8a5ba0
Contents?: true
Size: 578 Bytes
Versions: 5
Compression:
Stored size: 578 Bytes
Contents
require 'highline' module GitHelper class HighlineCli def ask(prompt) cli.ask(prompt) do |conf| conf.readline = true end.to_s end def ask_options(prompt, choices) choices_as_string_options = '' choices.each { |choice| choices_as_string_options << "#{choices.index(choice) + 1}. #{choice}\n" } compiled_prompt = "#{prompt}\n#{choices_as_string_options.strip}" cli.ask(compiled_prompt) do |conf| conf.readline = true end.to_i - 1 end private def cli @cli ||= HighLine.new end end end
Version data entries
5 entries across 5 versions & 1 rubygems