Class: PetriDish::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



8
9
10
# File 'lib/petri_dish/cli.rb', line 8

def initialize(argv)
  @argv = argv
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/petri_dish/cli.rb', line 12

def run
  if @argv.empty?
    usage
    exit 1
  end

  command = @argv.shift
  case command
  when "run"      then cmd_run
  when "list"     then cmd_list
  when "results"  then cmd_results
  when "setup"    then cmd_setup
  when "help", "--help", "-h"
    usage
  else
    $stderr.puts "Unknown command: #{command}"
    usage
    exit 1
  end
end