lib/shellplay/config.rb in shellplay-0.1.6 vs lib/shellplay/config.rb in shellplay-0.1.7

- old
+ new

@@ -1,23 +1,29 @@ require 'cliprompt' require 'configstruct' require 'fileutils' +# config struct class +# refer to https://github.com/mose/configstruct for documentation module Shellplay class Config < ConfigStruct include Cliprompt def initialize(options = nil, input = STDIN, output = STDOUT) super(options, input = STDIN, output = STDOUT, true) end + # override default config values def set_defaults default :basedir, File.join(ENV['HOME'], '.shellplay') default :basefile, File.join(self.basedir, 'config.yml') super end + # interactive configuration creation process + # uses cliprompt for console interaction + # refer to https://github.com/mose/cliprompt for documentation 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'