MCPcopy Index your code
hub / github.com/docker/cli / Write

Method Write

cli/command/formatter/formatter.go:126–142  ·  view source on GitHub ↗

Write the template to the buffer using this Context

(sub SubContext, f SubFormat)

Source from the content-addressed store, hash-verified

124
125// Write the template to the buffer using this Context
126func (c *Context) Write(sub SubContext, f SubFormat) error {
127 c.buffer = &bytes.Buffer{}
128 tmpl, err := c.parseFormat()
129 if err != nil {
130 return err
131 }
132
133 subFormat := func(subContext SubContext) error {
134 return c.contextFormat(tmpl, subContext)
135 }
136 if err := f(subFormat); err != nil {
137 return err
138 }
139
140 c.postFormat(tmpl, sub)
141 return nil
142}

Callers 7

TestContextFunction · 0.95
ImageWriteFunction · 0.45
BuildCacheWriteFunction · 0.45
VolumeWriteFunction · 0.45
ContainerWriteFunction · 0.45
ClientContextWriteFunction · 0.45

Calls 3

parseFormatMethod · 0.95
contextFormatMethod · 0.95
postFormatMethod · 0.95

Tested by 2

TestContextFunction · 0.76