Sha256: 5ca912104e63f294ac89e7a61756db55df6e74558ef8aab1112ddeec17497ffb
Contents?: true
Size: 801 Bytes
Versions: 6
Compression:
Stored size: 801 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) unless auto_prompt.nil? puts prompt return auto_prompt end Thor::Base.shell.new.yes?(prompt) end private def auto_prompt(prompt, options) options = options.with_indifferent_access 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
6 entries across 6 versions & 1 rubygems