Module: Chaptan::Command::Options

Defined in:
lib/chaptan/command/options.rb

Overview

Command line options

Class Method Summary collapse

Class Method Details

.parse!(argv) ⇒ Object



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

def self.parse!(argv)
  options = {}
  opt = OptionParser.new

  opt.on_head("-v", "--version", "Show version") do |_v|
    opt.version = Chaptan::VERSION
    puts opt.ver
    exit
  end

  opt.on_head("-y", "--yaml [filename]", "yaml file of data of chapters") do |v|
    options[:yaml] = v
  end
  opt.parse!(argv)

  options[:filename] = argv[0]

  options
end