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

Method Execute

cf/commands/stacks.go:56–81  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

54}
55
56func (cmd *ListStacks) Execute(c flags.FlagContext) error {
57 cmd.ui.Say(T("Getting stacks in org {{.OrganizationName}} / space {{.SpaceName}} as {{.Username}}...",
58 map[string]interface{}{"OrganizationName": terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
59 "SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
60 "Username": terminal.EntityNameColor(cmd.config.Username())}))
61
62 stacks, err := cmd.stacksRepo.FindAll()
63 if err != nil {
64 return err
65 }
66
67 cmd.ui.Ok()
68 cmd.ui.Say("")
69
70 table := cmd.ui.Table([]string{T("name"), T("description")})
71
72 for _, stack := range stacks {
73 table.Add(stack.Name, stack.Description)
74 }
75
76 err = table.Print()
77 if err != nil {
78 return err
79 }
80 return nil
81}

Callers

nothing calls this directly

Calls 10

EntityNameColorFunction · 0.92
SayMethod · 0.65
OrganizationFieldsMethod · 0.65
SpaceFieldsMethod · 0.65
UsernameMethod · 0.65
FindAllMethod · 0.65
OkMethod · 0.65
TableMethod · 0.65
AddMethod · 0.65
PrintMethod · 0.65

Tested by

no test coverage detected