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

Function ColoredInstanceState

cf/uihelpers/ui.go:51–71  ·  view source on GitHub ↗
(instance models.AppInstanceFields)

Source from the content-addressed store, hash-verified

49}
50
51func ColoredInstanceState(instance models.AppInstanceFields) (colored string) {
52 state := string(instance.State)
53 switch state {
54 case models.ApplicationStateStarted, models.ApplicationStateRunning:
55 colored = T("running")
56 case models.ApplicationStateStopped:
57 colored = terminal.StoppedColor(T("stopped"))
58 case models.ApplicationStateCrashed:
59 colored = terminal.CrashedColor(T("crashed"))
60 case models.ApplicationStateFlapping:
61 colored = terminal.CrashedColor(T("crashing"))
62 case models.ApplicationStateDown:
63 colored = terminal.CrashedColor(T("down"))
64 case models.ApplicationStateStarting:
65 colored = terminal.AdvisoryColor(T("starting"))
66 default:
67 colored = terminal.WarningColor(state)
68 }
69
70 return
71}

Callers 1

ShowAppMethod · 0.92

Calls 4

StoppedColorFunction · 0.92
CrashedColorFunction · 0.92
AdvisoryColorFunction · 0.92
WarningColorFunction · 0.92

Tested by

no test coverage detected