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

Function NewDiskUsageFormat

cli/command/formatter/disk_usage.go:54–83  ·  view source on GitHub ↗

NewDiskUsageFormat returns a format for rendering an DiskUsageContext

(source string, verbose bool)

Source from the content-addressed store, hash-verified

52
53// NewDiskUsageFormat returns a format for rendering an DiskUsageContext
54func NewDiskUsageFormat(source string, verbose bool) Format {
55 switch {
56 case verbose && source == RawFormatKey:
57 format := `{{range .Images}}type: Image
58` + NewImageFormat(source, false, true) + `
59{{end -}}
60{{range .Containers}}type: Container
61` + NewContainerFormat(source, false, true) + `
62{{end -}}
63{{range .Volumes}}type: Volume
64` + NewVolumeFormat(source, false) + `
65{{end -}}
66{{range .BuildCache}}type: Build Cache
67` + NewBuildCacheFormat(source, false) + `
68{{end -}}`
69 return format
70 case !verbose && source == TableFormatKey:
71 return defaultDiskUsageTableFormat
72 case !verbose && source == RawFormatKey:
73 format := `type: {{.Type}}
74total: {{.TotalCount}}
75active: {{.Active}}
76size: {{.Size}}
77reclaimable: {{.Reclaimable}}
78`
79 return Format(format)
80 default:
81 return Format(source)
82 }
83}
84
85func (ctx *DiskUsageContext) Write() (err error) {
86 if ctx.Verbose {

Callers 1

Calls 5

NewImageFormatFunction · 0.85
NewContainerFormatFunction · 0.85
NewVolumeFormatFunction · 0.85
NewBuildCacheFormatFunction · 0.85
FormatTypeAlias · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…