Class: Ec2list::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2list/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = []) ⇒ Command

Returns a new instance of Command.



5
6
7
8
# File 'lib/ec2list/command.rb', line 5

def initialize(argv = [])
  @options = build_options(argv)
  load_profile
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/ec2list/command.rb', line 3

def options
  @options
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/ec2list/command.rb', line 10

def run
  instances = fetch_instances
  
  if instances.empty?
    puts "No running instances"
    return
  end

  print_instances(instances)
end