Class: Plot::OptionParserWrapper

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

Constant Summary collapse

OPTIONS_DEFAULT =
{ file: 'check_log.yaml', plot: :cumulative }

Class Method Summary collapse

Class Method Details

.parse(args = ARGV) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/plot/plot.rb', line 12

def self.parse(args = ARGV)
  options = OPTIONS_DEFAULT.dup

  options[:cmd_line] = args.join(' ')
  opt = ::OptionParser.new
  opt.banner = "Usage: hc plot [options]"
  opt.on('-f FILE', '--file FILE', 'YAML file to use') do |v|
    options[:file] = v
  end
  opt.on('-s', '--score', 'Plot score_log.yaml') do
    options[:plot] = :score
    options[:file] = 'score_log.yaml'
  end
  opt.on('-w', '--word_size', 'Plot size from score_log.yaml') do
    options[:plot] = :word_size
    options[:file] = 'score_log.yaml'
  end
  opt.on('-L LAYER', '--layer LAYER', 'Specify layer directory') do |v|
    options[:layer] = v.to_i
  end
  opt.on('-d', '--dark', 'Use dark theme for plot') do
    options[:dark] = true
  end
  opt.parse!(args)
#      p options
  options
end