Sha256: b74168e5c8e53e6375a125b0e1ada176eb83a1541f5bb7d18930388cc7155cba

Contents?: true

Size: 491 Bytes

Versions: 10

Compression:

Stored size: 491 Bytes

Contents

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

require 'highline/import'
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

10 entries across 10 versions & 1 rubygems

Version Path
configliere-0.4.14 lib/configliere/prompt.rb
configliere-0.4.13 lib/configliere/prompt.rb
configliere-0.4.12 lib/configliere/prompt.rb
configliere-0.4.11 lib/configliere/prompt.rb
configliere-0.4.10 lib/configliere/prompt.rb
configliere-0.4.8 lib/configliere/prompt.rb
configliere-0.4.7 lib/configliere/prompt.rb
configliere-0.4.6 lib/configliere/prompt.rb
configliere-0.4.5 lib/configliere/prompt.rb
configliere-0.4.4 lib/configliere/prompt.rb