Sha256: 1d1327c3299cb6233848240db97159a5aea0989404754720bdb7e8255a48f395

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require 'cliprompt'
require 'configstruct'

module Shellplay
  class Config < ConfigStruct

    include Cliprompt

    def initialize(options = nil, input = STDIN, output = STDOUT)
      confdir = File.join(ENV['HOME'], '.shellplay')
      FileUtils.mkdir_p confdir unless Dir.exist? confdir
      super(options = nil, input = STDIN, output = STDOUT)
    end

    def set_defaults
      default :basedir, File.join(ENV['HOME'], '.shellplay')
      super
    end

    def setup
      values = {}
      output.puts Paint['Create a new shellplay configuration:', :blue]
      values['editor'] = guess 'EDITOR', 'What is the path to launch your text editor?', 'vim'
      values['prompt'] = ask 'What is the default prompt you want to use?'
      values['timeformat'] = ask 'What is the time format you want to display?', '%.1f'
      write values
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shellplay-0.0.8 lib/shellplay/config.rb