Module: Chimps::CLI

Defined in:
lib/chimps/cli.rb

Overview

Defines methods for choosing which Chimps::Command class should be instantiated from the ARGV passed in on the command line.

Defined Under Namespace

Classes: Runner

Class Method Summary collapse

Class Method Details

.execute!(argv) ⇒ Object

Execute the Chimps command specified by argv.

Will exit the Ruby process with 0 on success or 1 on an error.

Parameters:



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chimps/cli.rb', line 12

def self.execute! argv
  begin
    Runner.new(argv).execute!
    return 0
  rescue Chimps::Error => e
    puts e.message
    return 1
  rescue => e
    $stderr.puts("#{e.message} (#{e.class})")
    $stderr.puts(e.backtrace.join("\n"))
    return 1
  end
end