MCPcopy
hub / github.com/docker/compose / ContainerWrite

Function ContainerWrite

cmd/formatter/container.go:86–97  ·  view source on GitHub ↗

ContainerWrite renders the context for a list of containers

(ctx formatter.Context, containers []api.ContainerSummary)

Source from the content-addressed store, hash-verified

84
85// ContainerWrite renders the context for a list of containers
86func ContainerWrite(ctx formatter.Context, containers []api.ContainerSummary) error {
87 render := func(format func(subContext formatter.SubContext) error) error {
88 for _, container := range containers {
89 err := format(&ContainerContext{trunc: ctx.Trunc, c: container})
90 if err != nil {
91 return err
92 }
93 }
94 return nil
95 }
96 return ctx.Write(NewContainerContext(), render)
97}
98
99// ContainerContext is a struct used for rendering a list of containers in a Go template.
100type ContainerContext struct {

Callers 1

runPsFunction · 0.92

Calls 2

NewContainerContextFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected