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

Method contextFormat

cli/command/formatter/formatter.go:111–120  ·  view source on GitHub ↗
(tmpl *template.Template, subContext SubContext)

Source from the content-addressed store, hash-verified

109}
110
111func (c *Context) contextFormat(tmpl *template.Template, subContext SubContext) error {
112 if err := tmpl.Execute(c.buffer, subContext); err != nil {
113 return fmt.Errorf("template parsing error: %w", err)
114 }
115 if c.Format.IsTable() && c.header != nil {
116 c.header = subContext.FullHeader()
117 }
118 c.buffer.WriteString("\n")
119 return nil
120}
121
122// SubFormat is a function type accepted by Write()
123type SubFormat func(func(SubContext) error) error

Callers 3

WriteMethod · 0.95
WriteMethod · 0.80
verboseWriteTableMethod · 0.80

Calls 2

IsTableMethod · 0.80
FullHeaderMethod · 0.65

Tested by

no test coverage detected