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

Function newFormat

cli/command/network/formatter.go:26–40  ·  view source on GitHub ↗

newFormat returns a [formatter.Format] for rendering a networkContext.

(source string, quiet bool)

Source from the content-addressed store, hash-verified

24
25// newFormat returns a [formatter.Format] for rendering a networkContext.
26func newFormat(source string, quiet bool) formatter.Format {
27 switch source {
28 case formatter.TableFormatKey:
29 if quiet {
30 return formatter.DefaultQuietFormat
31 }
32 return defaultNetworkTableFormat
33 case formatter.RawFormatKey:
34 if quiet {
35 return `network_id: {{.ID}}`
36 }
37 return `network_id: {{.ID}}\nname: {{.Name}}\ndriver: {{.Driver}}\nscope: {{.Scope}}\n`
38 }
39 return formatter.Format(source)
40}
41
42// formatWrite writes the context.
43func formatWrite(fmtCtx formatter.Context, networks client.NetworkListResult) error {

Callers 2

TestNetworkContextWriteFunction · 0.70
runListFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestNetworkContextWriteFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…