Sha256: b796e9fa4127a59f19d201a661126d6dda4b5edd4dcf1be9af206394904fa637
Contents?: true
Size: 710 Bytes
Versions: 11
Compression:
Stored size: 710 Bytes
Contents
# frozen_string_literal: true require 'thor' module Dsu module Support module Ask def ask(prompt) options = {} Thor::LineEditor.readline(prompt, options) end def yes?(prompt, options: {}) auto_prompt = auto_prompt(prompt, options) return auto_prompt unless auto_prompt.nil? Thor::Base.shell.new.yes?(prompt) end private def auto_prompt(prompt, options) prompt = Utils.strip_escapes(prompt) @auto_prompt ||= begin value = options.dig('prompts', prompt) || options.dig('prompts', 'any') value = (value == 'true' unless value.nil?) value end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems