Class: Pitcher::PitcherOpts

Inherits:
Object
  • Object
show all
Defined in:
lib/pitcher/options.rb

Instance Method Summary collapse

Instance Method Details

#parse(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pitcher/options.rb', line 7

def parse(args)
  options = OpenStruct.new

  OptionParser.new do |opts|
    opts.banner = 'Usage: pitcher -csv /path/to/csv.file'

    opts.on("-csv", "--csv", 'Path to CSV file') do |csv|
      options.csv = csv
    end

    opts.on("-settings", "--settings", "Path to the settings file") do |settings|
      options.settings = settings
    end

    opts.on("-h", "--help", "Pitcher Help") do
      puts opts
      exit
    end

  end.parse!
  options
end