MCPcopy Create free account
hub / github.com/conforma/cli / HasState

Function HasState

acceptance/testenv/testenv.go:204–217  ·  view source on GitHub ↗

HasState returns true if the state for the provided type is present in the context

(ctx context.Context)

Source from the content-addressed store, hash-verified

202
203// HasState returns true if the state for the provided type is present in the context
204func HasState[S WithState](ctx context.Context) bool {
205 p := ctx.Value(persistedEnv)
206 if p == nil {
207 return false
208 }
209
210 newS := *new(S)
211 key := persistedKey(newS)
212
213 store := *p.(*map[string]any)
214
215 state := store[key]
216 return state != nil
217}
218
219// NoColorOutput returns true if the output produced should not contain colors, which is
220// useful when a terminal or medium can't interpret ANSI colors

Callers

nothing calls this directly

Calls 1

persistedKeyFunction · 0.85

Tested by

no test coverage detected