Sha256: 10ee1916d8a2077484ac057b29b55b2b8bc3e3d70a242418ac9a5ab8620bca74
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
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' 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shellplay-0.1.9 | lib/shellplay/config.rb |
shellplay-0.1.8 | lib/shellplay/config.rb |
shellplay-0.1.7 | lib/shellplay/config.rb |