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

Function NewBuildCacheFormat

cli/command/formatter/buildcache.go:26–52  ·  view source on GitHub ↗

NewBuildCacheFormat returns a Format for rendering using a Context

(source string, quiet bool)

Source from the content-addressed store, hash-verified

24
25// NewBuildCacheFormat returns a Format for rendering using a Context
26func NewBuildCacheFormat(source string, quiet bool) Format {
27 switch source {
28 case TableFormatKey:
29 if quiet {
30 return DefaultQuietFormat
31 }
32 return Format(defaultBuildCacheTableFormat)
33 case RawFormatKey:
34 if quiet {
35 return `build_cache_id: {{.ID}}`
36 }
37 format := `build_cache_id: {{.ID}}
38parent_id: {{.Parent}}
39build_cache_type: {{.CacheType}}
40description: {{.Description}}
41created_at: {{.CreatedAt}}
42created_since: {{.CreatedSince}}
43last_used_at: {{.LastUsedAt}}
44last_used_since: {{.LastUsedSince}}
45usage_count: {{.UsageCount}}
46in_use: {{.InUse}}
47shared: {{.Shared}}
48`
49 return Format(format)
50 }
51 return Format(source)
52}
53
54func buildCacheSort(buildCache []build.CacheRecord) {
55 sort.Slice(buildCache, func(i, j int) bool {

Callers 1

NewDiskUsageFormatFunction · 0.85

Calls 1

FormatTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…