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

Function newTaskFormat

cli/command/task/formatter.go:27–41  ·  view source on GitHub ↗

newTaskFormat returns a Format for rendering using a taskContext.

(source string, quiet bool)

Source from the content-addressed store, hash-verified

25
26// newTaskFormat returns a Format for rendering using a taskContext.
27func newTaskFormat(source string, quiet bool) formatter.Format {
28 switch source {
29 case formatter.TableFormatKey:
30 if quiet {
31 return formatter.DefaultQuietFormat
32 }
33 return defaultTaskTableFormat
34 case formatter.RawFormatKey:
35 if quiet {
36 return `id: {{.ID}}`
37 }
38 return `id: {{.ID}}\nname: {{.Name}}\nimage: {{.Image}}\nnode: {{.Node}}\ndesired_state: {{.DesiredState}}\ncurrent_state: {{.CurrentState}}\nerror: {{.Error}}\nports: {{.Ports}}\n`
39 }
40 return formatter.Format(source)
41}
42
43// formatWrite writes the context.
44func formatWrite(fmtCtx formatter.Context, tasks client.TaskListResult, names map[string]string, nodes map[string]string) error {

Callers 2

TestTaskContextWriteFunction · 0.85
PrintFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestTaskContextWriteFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…