Class: RSpec::FlakeClassifier::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/flake/classifier/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdout: $stdout, stderr: $stderr) ⇒ CLI

Returns a new instance of CLI.



10
11
12
13
14
15
# File 'lib/rspec/flake/classifier/cli.rb', line 10

def initialize(argv, stdout: $stdout, stderr: $stderr)
  @argv = argv.dup
  @stdout = stdout
  @stderr = stderr
  @options = { store: Configuration::DEFAULT_STORE, format: "text" }
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rspec/flake/classifier/cli.rb', line 17

def run
  command = argv.shift
  return usage(1) unless command

  case command
  when "investigate" then investigate
  when "classify" then classify
  when "features" then features
  when "predict" then predict
  when "train" then train
  when "evaluate" then evaluate
  when "sensitivity" then sensitivity
  when "report" then report
  else
    stderr.puts("Unknown command: #{command}")
    usage(1)
  end
rescue OptionParser::ParseError, Error => e
  stderr.puts(e.message)
  1
end