MCPcopy Create free account
hub / github.com/docker/cli / inspectFormatWrite

Function inspectFormatWrite

cli/command/secret/formatter.go:128–148  ·  view source on GitHub ↗

inspectFormatWrite renders the context for a list of secrets.

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

Source from the content-addressed store, hash-verified

126
127// inspectFormatWrite renders the context for a list of secrets.
128func inspectFormatWrite(fmtCtx formatter.Context, refs []string, getRef inspect.GetRefFunc) error {
129 if fmtCtx.Format != secretInspectPrettyTemplate {
130 return inspect.Inspect(fmtCtx.Output, refs, string(fmtCtx.Format), getRef)
131 }
132 return fmtCtx.Write(&secretInspectContext{}, func(format func(subContext formatter.SubContext) error) error {
133 for _, ref := range refs {
134 secretI, _, err := getRef(ref)
135 if err != nil {
136 return err
137 }
138 secret, ok := secretI.(swarm.Secret)
139 if !ok {
140 return fmt.Errorf("got wrong object to inspect :%v", ok)
141 }
142 if err := format(&secretInspectContext{Secret: secret}); err != nil {
143 return err
144 }
145 }
146 return nil
147 })
148}
149
150type secretInspectContext struct {
151 swarm.Secret

Callers 1

runSecretInspectFunction · 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…