Method: VMC::Cli::Command::Misc#info

Defined in:
lib/cli/commands/misc.rb

#infoObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cli/commands/misc.rb', line 45

def info
  info = client_info
  return display JSON.pretty_generate(info) if @options[:json]

  display "\n#{info[:description]}"
  display "For support visit #{info[:support]}"
  display ""
  display "Target:   #{target_url} (v#{info[:version]})"
  display "Client:   v#{VMC::Cli::VERSION}"
  if info[:user]
    display ''
    display "User:     #{info[:user]}"
  end
  if usage = info[:usage] and limits = info[:limits]
    tmem  = pretty_size(limits[:memory]*1024*1024)
    mem   = pretty_size(usage[:memory]*1024*1024)
    tser  = limits[:services]
    ser   = usage[:services]
    tapps = limits[:apps] || 0
    apps  = usage[:apps]  || 0
    display "Usage:    Memory   (#{mem} of #{tmem} total)"
    display "          Services (#{ser} of #{tser} total)"
    display "          Apps     (#{apps} of #{tapps} total)" if limits[:apps]
  end
end