class Cfgd::UI
Simple user interface for cfgd
Public Class Methods
new()
click to toggle source
# File lib/ui.rb, line 8 def initialize set_default_options parse_options start_cfgd end
Protected Instance Methods
die(msg)
click to toggle source
# File lib/ui.rb, line 43 def die(msg) warn(msg) exit 1 end
parse_options()
click to toggle source
# File lib/ui.rb, line 27 def parse_options OptionParser.new do |opts| opts.banner = 'Usage: cfgd [options]' opts.on('-c', '--config FILE', 'Config file to use') do |file| if File.exist?(file) @opts[:config] = file else die("Config file #{file} does not exist") end end opts.on('-d', '--debug', 'Verbose/Debug mode') do @opts[:debug] = true end end.parse! end
set_default_options()
click to toggle source
# File lib/ui.rb, line 20 def set_default_options @opts = { config: '/etc/cfgd.rb', debug: false } end
start_cfgd()
click to toggle source
# File lib/ui.rb, line 16 def start_cfgd require @opts[:config] end