Class: Parser

Inherits:
Object
  • Object
show all
Defined in:
bin/badslava2csv

Class Method Summary collapse

Class Method Details

.parse(options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'bin/badslava2csv', line 14

def self.parse(options)
  args = Options.new("San Francisco", "./data")

  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: badslava2csv [options]"

    opts.on("-cCITY", "--city=CITY", "City to list") do |city|
      args.city = city
    end

    opts.on("-oOUTPUTDIR", "--output-dir=OUTPUTDIR", "Output Director") do |output_dir|
      args.output_dir = output_dir
    end

    opts.on("-h", "--help", "Prints this help") do
      puts opts
      exit
    end
  end

  opt_parser.parse!(options)
  return args
end