Class: Corkscrews::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



14
15
16
# File 'lib/corkscrews/cli.rb', line 14

def initialize(argv)
  @argv = argv.dup
end

Instance Method Details

#runObject



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

def run
  command = @argv.shift

  case command
  when "run"
    run_profile(@argv)
  when "report"
    run_report(@argv)
  when "validate"
    run_validate(@argv)
  when "-h", "--help", nil
    puts help
    0
  else
    warn "unknown command: #{command}"
    warn help
    2
  end
rescue Error => e
  warn "error: #{e.message}"
  1
end