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

Function ColoredAppInstances

cf/uihelpers/ui.go:30–49  ·  view source on GitHub ↗
(app models.ApplicationFields)

Source from the content-addressed store, hash-verified

28}
29
30func ColoredAppInstances(app models.ApplicationFields) string {
31 healthString := fmt.Sprintf("%d/%d", app.RunningInstances, app.InstanceCount)
32
33 if app.RunningInstances < 0 {
34 healthString = fmt.Sprintf("?/%d", app.InstanceCount)
35 }
36
37 if app.RunningInstances == 0 {
38 if strings.ToLower(app.State) == models.ApplicationStateStopped {
39 return healthString
40 }
41 return terminal.CrashedColor(healthString)
42 }
43
44 if app.RunningInstances < app.InstanceCount {
45 return terminal.WarningColor(healthString)
46 }
47
48 return healthString
49}
50
51func ColoredInstanceState(instance models.AppInstanceFields) (colored string) {
52 state := string(instance.State)

Callers 2

ExecuteMethod · 0.92
ShowAppMethod · 0.92

Calls 2

CrashedColorFunction · 0.92
WarningColorFunction · 0.92

Tested by

no test coverage detected