Class: Sassconf::Parser
Defined Under Namespace
Modules: HelpText
Class Method Summary collapse
Class Method Details
.parse(options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/sassconf.rb', line 23 def self.parse() option_args = OpenStruct.new option_args.config_path = String.empty option_args.extern_args = String.empty opt_parser = OptionParser.new do |opts| opts. = HelpText::USAGE opts.separator(HelpText::DESCRIPTION) opts.separator(HelpText::REQUIRED) opts.on('-c', '--config CONFIG_FILE ', String, 'Specify a ruby config file e.g.: ', '/PATH/config.rb') do |elem| option_args.config_path = elem end opts.separator(HelpText::OPTIONAL) opts.on('-a', '--args ARGS', String, 'Comma separated list of values e.g.:', 'val_a, val_b,...'.paragraph) do |elem| option_args.extern_args = elem end opts.on('-v', '--verbose', 'Print all log messages.') do Sassconf::Logging.activate() end opts.on('-?', '-h', '--help', 'Show this help. "Wow you really need this help?! ... Me too. ;)"') do puts opts exit end end opt_parser.parse!() if option_args.config_path.empty? puts opt_parser exit end return option_args end |