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

Function newFormat

cli/command/node/formatter.go:83–99  ·  view source on GitHub ↗

newFormat returns a Format for rendering using a nodeContext.

(source string, quiet bool)

Source from the content-addressed store, hash-verified

81
82// newFormat returns a Format for rendering using a nodeContext.
83func newFormat(source string, quiet bool) formatter.Format {
84 switch source {
85 case formatter.PrettyFormatKey:
86 return nodeInspectPrettyTemplate
87 case formatter.TableFormatKey:
88 if quiet {
89 return formatter.DefaultQuietFormat
90 }
91 return defaultNodeTableFormat
92 case formatter.RawFormatKey:
93 if quiet {
94 return `node_id: {{.ID}}`
95 }
96 return `node_id: {{.ID}}\nhostname: {{.Hostname}}\nstatus: {{.Status}}\navailability: {{.Availability}}\nmanager_status: {{.ManagerStatus}}\n`
97 }
98 return formatter.Format(source)
99}
100
101// formatWrite writes the context.
102func formatWrite(fmtCtx formatter.Context, nodes client.NodeListResult, info client.SystemInfoResult) error {

Callers 4

TestNodeContextWriteFunction · 0.70
runInspectFunction · 0.70
runListFunction · 0.70

Calls

no outgoing calls

Tested by 2

TestNodeContextWriteFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…