Method: Shomen::CLI::Abstract#parse

Defined in:
lib/shomen/cli/abstract.rb

#parse(argv, *choices) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/shomen/cli/abstract.rb', line 21

def parse(argv, *choices)
  options = (Hash === choices.last ? choices.pop : {})
  parser  = OptionParser.new

  choices.each do |choice|
    send("option_#{choice}", parser, options)
  end
  option_debug(parser, options)
  option_warn(parser, options)
  option_help(parser, options)

  parser.parse!(argv)

  return options
end