Class: Meroku::CLI

Inherits:
Object
  • Object
show all
Includes:
Shared
Defined in:
lib/meroku/cli.rb

Overview

The CLI is a class responsible of handling all the command line interface logic.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared

ec2_client

Constructor Details

#initializeCLI

Returns a new instance of CLI.



10
11
12
# File 'lib/meroku/cli.rb', line 10

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#run(args = ARGV) ⇒ Object



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

def run(args = ARGV)
  @options = Options.new.parse(args)
  act_on_options
rescue Meroku::Success
  return 0
rescue StandardError => e
  print 'Error:'
  print " #{e.message}" if e.message
  print " <#{e.class}>\n"
  return 2
end