Sha256: f91c8264e6062498990c3a5fd922403d75f3d6886add7c4805e86a6e5a1a4196

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

require 'cliprompt'
require 'configstruct'
require 'fileutils'

module Shellplay
  class Config < ConfigStruct

    include Cliprompt

    def initialize(options = nil, input = STDIN, output = STDOUT)
      super(options, input = STDIN, output = STDOUT)
    end

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

    def setup
      unless self.prompt && self.timeformat
        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?', "\e[36m #{ENV['USER']} > \e[0m"
        values['timeformat'] = ask 'What is the time format you want to display?', '%.1f'
        write values
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shellplay-0.1.5 lib/shellplay/config.rb
shellplay-0.1.4 lib/shellplay/config.rb
shellplay-0.1.3 lib/shellplay/config.rb
shellplay-0.1.2 lib/shellplay/config.rb
shellplay-0.1.1 lib/shellplay/config.rb