Sha256: b36435352cf61311b6d63beec660c5339dbb79c69c6b7fc1ea654bedca498a7b

Contents?: true

Size: 705 Bytes

Versions: 4

Compression:

Stored size: 705 Bytes

Contents

# Settings.use :prompt
# you must install the highline gem

begin
  require 'highline/import'
rescue LoadError, NameError => err
  warn "************"
  warn "Highline does not work with JRuby 1.7.0+ as of Mid 2012. See https://github.com/JEG2/highline/issues/41."
  warn "************"
  raise
end

module Configliere
  #
  # Method to prompt for
  #
  module Prompt

    # Retrieve the given param, or prompt for it
    def prompt_for attr, hint=nil
      return self[attr] if has_key?(attr)
      hint ||= definition_of(attr, :description)
      hint   = " (#{hint})" if hint
      self[attr] = ask("#{attr}#{hint}? ")
    end
  end

  Param.on_use(:prompt) do
    extend Configliere::Prompt
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
configliere-0.4.22 lib/configliere/prompt.rb
configliere-0.4.18 lib/configliere/prompt.rb
configliere-0.4.17 lib/configliere/prompt.rb
configliere-0.4.16 lib/configliere/prompt.rb