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

Function formatWrite

cli/command/node/formatter.go:102–128  ·  view source on GitHub ↗

formatWrite writes the context.

(fmtCtx formatter.Context, nodes client.NodeListResult, info client.SystemInfoResult)

Source from the content-addressed store, hash-verified

100
101// formatWrite writes the context.
102func formatWrite(fmtCtx formatter.Context, nodes client.NodeListResult, info client.SystemInfoResult) error {
103 nodeCtx := &nodeContext{
104 HeaderContext: formatter.HeaderContext{
105 Header: formatter.SubHeaderContext{
106 "ID": nodeIDHeader,
107 "Self": selfHeader,
108 "Hostname": hostnameHeader,
109 "Status": formatter.StatusHeader,
110 "Availability": availabilityHeader,
111 "ManagerStatus": managerStatusHeader,
112 "EngineVersion": engineVersionHeader,
113 "TLSStatus": tlsStatusHeader,
114 },
115 },
116 }
117 return fmtCtx.Write(nodeCtx, func(format func(subContext formatter.SubContext) error) error {
118 for _, node := range nodes.Items {
119 if err := format(&nodeContext{
120 n: node,
121 info: info.Info.Swarm,
122 }); err != nil {
123 return err
124 }
125 }
126 return nil
127 })
128}
129
130type nodeContext struct {
131 formatter.HeaderContext

Callers 4

TestNodeContextWriteFunction · 0.70
TestNodeContextWriteJSONFunction · 0.70
runListFunction · 0.70

Calls 2

formatFunction · 0.85
WriteMethod · 0.45

Tested by 3

TestNodeContextWriteFunction · 0.56
TestNodeContextWriteJSONFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…