MCPcopy Create free account
hub / github.com/cli/cli / ColorFuncForSessionState

Function ColorFuncForSessionState

pkg/cmd/agent-task/shared/display.go:9–25  ·  view source on GitHub ↗

ColorFuncForSessionState returns a function that colors the session state

(s capi.Session, cs *iostreams.ColorScheme)

Source from the content-addressed store, hash-verified

7
8// ColorFuncForSessionState returns a function that colors the session state
9func ColorFuncForSessionState(s capi.Session, cs *iostreams.ColorScheme) func(string) string {
10 var stateColor func(string) string
11 switch s.State {
12 case "completed":
13 stateColor = cs.Green
14 case "cancelled":
15 stateColor = cs.Muted
16 case "in_progress", "queued":
17 stateColor = cs.Yellow
18 case "failed":
19 stateColor = cs.Red
20 default:
21 stateColor = cs.Muted
22 }
23
24 return stateColor
25}
26
27// SessionStateString returns the humane/capitalised form of the given session state.
28func SessionStateString(state string) string {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected