Class: Fission::Command::Status

Inherits:
Fission::Command show all
Defined in:
lib/fission.old/command/status.rb

Instance Attribute Summary

Attributes inherited from Fission::Command

#args, #options

Instance Method Summary collapse

Methods inherited from Fission::Command

help

Constructor Details

#initialize(args = []) ⇒ Status

Returns a new instance of Status.



5
6
7
# File 'lib/fission.old/command/status.rb', line 5

def initialize(args=[])
  super
end

Instance Method Details

#executeObject



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

def execute

  all_vms=Fission::VM.all
  vm_with_longest_name = all_vms.max { |a,b| a.name.length <=> b.name.length }
  max_name_length=vm_with_longest_name.name.length
  all_vms.each do |vm|
    status = vm.state
    Fission.ui.output_printf "%-#{max_name_length}s   %s\n", vm.name, "["+status+"]"
  end

end

#option_parserObject



21
22
23
24
25
26
27
# File 'lib/fission.old/command/status.rb', line 21

def option_parser
  optparse = OptionParser.new do |opts|
    opts.banner = "\nstatus usage: fission status"
  end

  optparse
end