MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Execute

Method Execute

cf/commands/space/space.go:73–150  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

71}
72
73func (cmd *ShowSpace) Execute(c flags.FlagContext) error {
74 space := cmd.spaceReq.GetSpace()
75 if cmd.pluginCall {
76 cmd.populatePluginModel(space)
77 return nil
78 }
79 if c.Bool("guid") {
80 cmd.ui.Say(space.GUID)
81 } else {
82 cmd.ui.Say(T("Getting info for space {{.TargetSpace}} in org {{.OrgName}} as {{.CurrentUser}}...",
83 map[string]interface{}{
84 "TargetSpace": terminal.EntityNameColor(space.Name),
85 "OrgName": terminal.EntityNameColor(space.Organization.Name),
86 "CurrentUser": terminal.EntityNameColor(cmd.config.Username()),
87 }))
88
89 quotaString, err := cmd.quotaString(space)
90 if err != nil {
91 return err
92 }
93
94 cmd.ui.Ok()
95 cmd.ui.Say("")
96 table := cmd.ui.Table([]string{terminal.EntityNameColor(space.Name), "", ""})
97 table.Add("", T("Org:"), terminal.EntityNameColor(space.Organization.Name))
98
99 apps := []string{}
100 for _, app := range space.Applications {
101 apps = append(apps, terminal.EntityNameColor(app.Name))
102 }
103 table.Add("", T("Apps:"), strings.Join(apps, ", "))
104
105 domains := []string{}
106 for _, domain := range space.Domains {
107 domains = append(domains, terminal.EntityNameColor(domain.Name))
108 }
109 table.Add("", T("Domains:"), strings.Join(domains, ", "))
110
111 services := []string{}
112 for _, service := range space.ServiceInstances {
113 services = append(services, terminal.EntityNameColor(service.Name))
114 }
115 table.Add("", T("Services:"), strings.Join(services, ", "))
116
117 securityGroups := []string{}
118 for _, group := range space.SecurityGroups {
119 securityGroups = append(securityGroups, terminal.EntityNameColor(group.Name))
120 }
121 table.Add("", T("Security Groups:"), strings.Join(securityGroups, ", "))
122
123 table.Add("", T("Space Quota:"), terminal.EntityNameColor(quotaString))
124
125 err = table.Print()
126 if err != nil {
127 return err
128 }
129 }
130 if c.Bool("security-group-rules") {

Callers

nothing calls this directly

Calls 11

populatePluginModelMethod · 0.95
quotaStringMethod · 0.95
EntityNameColorFunction · 0.92
GetSpaceMethod · 0.65
BoolMethod · 0.65
SayMethod · 0.65
UsernameMethod · 0.65
OkMethod · 0.65
TableMethod · 0.65
AddMethod · 0.65
PrintMethod · 0.65

Tested by

no test coverage detected