Class: ResourceIn::Command

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

Class Method Summary collapse

Class Method Details

.get(opts, argv) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/resource_in/command.rb', line 22

def self.get(opts, argv)
  machine = Machine.new

  data = machine.get(argv.first)

  if data != [nil]
    machine.output_detail(data)
  else
    puts "warning: no such resource '#{argv.first}' in this environment."
    exit 1
  end
end

.list(opts, argv) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/resource_in/command.rb', line 8

def self.list(opts, argv)
  resource_kls = case opts[:type]
  when 'all'
    Machine
  when 'machine'
    Machine
  else
    raise 'unknown type is detected'
  end

  resource = resource_kls.new

  resource.output(resource.filter(argv.first, resource.list))
end