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

Function inspectFormatWrite

cli/command/config/formatter.go:121–141  ·  view source on GitHub ↗

inspectFormatWrite renders the context for a list of configs

(fmtCtx formatter.Context, refs []string, getRef inspect.GetRefFunc)

Source from the content-addressed store, hash-verified

119
120// inspectFormatWrite renders the context for a list of configs
121func inspectFormatWrite(fmtCtx formatter.Context, refs []string, getRef inspect.GetRefFunc) error {
122 if fmtCtx.Format != configInspectPrettyTemplate {
123 return inspect.Inspect(fmtCtx.Output, refs, string(fmtCtx.Format), getRef)
124 }
125 return fmtCtx.Write(&configInspectContext{}, func(format func(subContext formatter.SubContext) error) error {
126 for _, ref := range refs {
127 configI, _, err := getRef(ref)
128 if err != nil {
129 return err
130 }
131 config, ok := configI.(swarm.Config)
132 if !ok {
133 return fmt.Errorf("got wrong object to inspect :%v", ok)
134 }
135 if err := format(&configInspectContext{Config: config}); err != nil {
136 return err
137 }
138 }
139 return nil
140 })
141}
142
143type configInspectContext struct {
144 swarm.Config

Callers 1

runInspectFunction · 0.70

Calls 3

formatFunction · 0.85
InspectMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…