Class: Pain::Options

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

Overview

rubocop:disable Metrics/MethodLength

Class Method Summary collapse

Class Method Details

.create(options, model) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/pain/cli.rb', line 132

def self.create(options, model)
  OptionParser.new do |opts|
    opts.on(
      '-l',
      '--likelihood [LIKELIHOOD]',
      OptionParser::DecimalInteger,
      model.input_message(:likelihood)
    ) do |like|
      options[:likelihood] = model.normalize(like, :likelihood)
    end

    opts.on(
      '-i',
      '--impact [IMPACT]',
      OptionParser::DecimalInteger,
      model.input_message(:impact)
    ) do |impact|
      options[:impact] = model.normalize(impact, :impact)
    end

    opts.on(
      '-t',
      '--type [TYPE]',
      OptionParser::DecimalInteger,
      model.input_message(:bug_type)
    ) do |bug_type|
      options[:bug_type] = model.normalize(bug_type, :bug_type)
    end
  end
end