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

Function formatWrite

cli/command/network/formatter.go:43–70  ·  view source on GitHub ↗

formatWrite writes the context.

(fmtCtx formatter.Context, networks client.NetworkListResult)

Source from the content-addressed store, hash-verified

41
42// formatWrite writes the context.
43func formatWrite(fmtCtx formatter.Context, networks client.NetworkListResult) error {
44 networkCtx := networkContext{
45 HeaderContext: formatter.HeaderContext{
46 Header: formatter.SubHeaderContext{
47 "ID": networkIDHeader,
48 "Name": formatter.NameHeader,
49 "Driver": formatter.DriverHeader,
50 "Scope": formatter.ScopeHeader,
51 "IPv4": ipv4Header,
52 "IPv6": ipv6Header,
53 "Internal": internalHeader,
54 "Labels": formatter.LabelsHeader,
55 "CreatedAt": formatter.CreatedAtHeader,
56 },
57 },
58 }
59 return fmtCtx.Write(&networkCtx, func(format func(subContext formatter.SubContext) error) error {
60 for _, nw := range networks.Items {
61 if err := format(&networkContext{
62 trunc: fmtCtx.Trunc,
63 n: nw,
64 }); err != nil {
65 return err
66 }
67 }
68 return nil
69 })
70}
71
72type networkContext struct {
73 formatter.HeaderContext

Callers 4

TestNetworkContextWriteFunction · 0.70
runListFunction · 0.70

Calls 2

formatFunction · 0.85
WriteMethod · 0.45

Tested by 3

TestNetworkContextWriteFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…