Method: VMC::App::Apps#apps

Defined in:
lib/vmc/cli/app/apps.rb

#appsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vmc/cli/app/apps.rb', line 15

def apps
  if space = input[:space]
    begin
      space.summarize!
    rescue CFoundry::APIError
    end

    apps =
      with_progress("Getting applications in #{c(space.name, :name)}") do
        space.apps
      end
  else
    apps =
      with_progress("Getting applications") do
        client.apps(:depth => 2)
      end
  end

  line unless quiet?

  if apps.empty? and !quiet?
    line "No applications."
    return
  end

  apps.reject! do |a|
    !app_matches?(a, input)
  end

  apps = apps.sort_by(&:name)

  if input[:full]
    spaced(apps) do |a|
      invoke :app, :app => a
    end
  elsif quiet?
    apps.each do |a|
      line a.name
    end
  else
    display_apps_table(apps)
  end
end