Class: Sr71::CLI::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/sr71/cli.rb

Instance Method Summary collapse

Instance Method Details

#parse!(args) ⇒ Object



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

def parse!(args)
  args, options = args.dup, {}

  options[:sr71_config] = '/etc/sr71.yml'

  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: sr71 [options]"
    opts.on("-c", "--config=file", String, "SR71 configuration file") { |v| options[:sr71_config] = v }

    opts.separator ""

    opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
  end

  opt_parser.parse! args

  options
end