Module: Lowkiq::OptionParser

Defined in:
lib/lowkiq/option_parser.rb

Class Method Summary collapse

Class Method Details

.call(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lowkiq/option_parser.rb', line 5

def call(args)
  options = {
  }
  ::OptionParser.new do |parser|
    parser.on("-r", "--require PATH") do |path|
      options[:require] = path
    end

    parser.on("-h", "--help", "Prints this help") do
      puts parser
      exit
    end
  end.parse!(args)

  fail "--require is required option" if options[:require].nil? || options[:require].empty?

  options
end