MCPcopy
hub / github.com/cloudfoundry/cli / Execute

Method Execute

cf/commands/stack.go:60–88  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

58}
59
60func (cmd *ListStack) Execute(c flags.FlagContext) error {
61 stackName := c.Args()[0]
62
63 stack, err := cmd.stacksRepo.FindByName(stackName)
64
65 if c.Bool("guid") {
66 cmd.ui.Say(stack.GUID)
67 } else {
68 if err != nil {
69 return err
70 }
71
72 cmd.ui.Say(T("Getting stack '{{.Stack}}' in org {{.OrganizationName}} / space {{.SpaceName}} as {{.Username}}...",
73 map[string]interface{}{"Stack": stackName,
74 "OrganizationName": terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
75 "SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
76 "Username": terminal.EntityNameColor(cmd.config.Username())}))
77
78 cmd.ui.Ok()
79 cmd.ui.Say("")
80 table := cmd.ui.Table([]string{T("name"), T("description")})
81 table.Add(stack.Name, stack.Description)
82 err = table.Print()
83 if err != nil {
84 return err
85 }
86 }
87 return nil
88}

Callers

nothing calls this directly

Calls 12

EntityNameColorFunction · 0.92
ArgsMethod · 0.65
FindByNameMethod · 0.65
BoolMethod · 0.65
SayMethod · 0.65
OrganizationFieldsMethod · 0.65
SpaceFieldsMethod · 0.65
UsernameMethod · 0.65
OkMethod · 0.65
TableMethod · 0.65
AddMethod · 0.65
PrintMethod · 0.65

Tested by

no test coverage detected