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

Method Execute

cf/commands/routergroups/router_groups.go:55–82  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

53}
54
55func (cmd *RouterGroups) Execute(c flags.FlagContext) error {
56 cmd.ui.Say(T("Getting router groups as {{.Username}} ...\n",
57 map[string]interface{}{"Username": terminal.EntityNameColor(cmd.config.Username())}))
58
59 table := cmd.ui.Table([]string{T("name"), T("type")})
60
61 noRouterGroups := true
62 cb := func(group models.RouterGroup) bool {
63 noRouterGroups = false
64 table.Add(group.Name, group.Type)
65 return true
66 }
67
68 apiErr := cmd.routingAPIRepo.ListRouterGroups(cb)
69 if apiErr != nil {
70 return errors.New(T("Failed fetching router groups.\n{{.Err}}", map[string]interface{}{"Err": apiErr.Error()}))
71 }
72
73 if noRouterGroups {
74 cmd.ui.Say(T("No router groups found"))
75 }
76
77 err := table.Print()
78 if err != nil {
79 return err
80 }
81 return nil
82}

Callers

nothing calls this directly

Calls 8

EntityNameColorFunction · 0.92
SayMethod · 0.65
UsernameMethod · 0.65
TableMethod · 0.65
AddMethod · 0.65
ListRouterGroupsMethod · 0.65
ErrorMethod · 0.65
PrintMethod · 0.65

Tested by

no test coverage detected