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

Method ApplicationStart

cf/commands/application/start.go:138–155  ·  view source on GitHub ↗
(app models.Application, orgName, spaceName string)

Source from the content-addressed store, hash-verified

136}
137
138func (cmd *Start) ApplicationStart(app models.Application, orgName, spaceName string) (models.Application, error) {
139 if app.State == "started" {
140 cmd.ui.Say(terminal.WarningColor(T("App ") + app.Name + T(" is already started")))
141 return models.Application{}, nil
142 }
143
144 return cmd.WatchStaging(app, orgName, spaceName, func(app models.Application) (models.Application, error) {
145 cmd.ui.Say(T("Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
146 map[string]interface{}{
147 "AppName": terminal.EntityNameColor(app.Name),
148 "OrgName": terminal.EntityNameColor(orgName),
149 "SpaceName": terminal.EntityNameColor(spaceName),
150 "CurrentUser": terminal.EntityNameColor(cmd.config.Username())}))
151
152 state := "started"
153 return cmd.appRepo.Update(app.GUID, models.AppParams{State: &state})
154 })
155}
156
157func (cmd *Start) WatchStaging(app models.Application, orgName, spaceName string, start func(app models.Application) (models.Application, error)) (models.Application, error) {
158 stopChan := make(chan bool, 1)

Callers 1

ExecuteMethod · 0.95

Calls 6

WatchStagingMethod · 0.95
WarningColorFunction · 0.92
EntityNameColorFunction · 0.92
SayMethod · 0.65
UsernameMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected