Skip to content

Commit 2017294

Browse files
committed
Update build du command to show last accessed and usage count
1 parent cb9b366 commit 2017294

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Join `#buildkit` channel on [Docker Community Slack](https://dockr.ly/comm-slack
4242
4343
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4444
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
45+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4546

4647
- [Used by](#used-by)
4748
- [Quick start](#quick-start)

cmd/buildctl/diskusage.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func printTable(tw *tabwriter.Writer, du []*client.UsageInfo) {
118118
}
119119

120120
func printTableHeader(tw *tabwriter.Writer) {
121-
fmt.Fprintln(tw, "ID\tRECLAIMABLE\tSIZE\tLAST ACCESSED")
121+
fmt.Fprintln(tw, "ID\tRECLAIMABLE\tSIZE\tLAST ACCESSED\tUSAGE COUNT")
122122
}
123123

124124
func printTableRow(tw *tabwriter.Writer, di *client.UsageInfo) {
@@ -130,7 +130,11 @@ func printTableRow(tw *tabwriter.Writer, di *client.UsageInfo) {
130130
if di.Shared {
131131
size += "*"
132132
}
133-
fmt.Fprintf(tw, "%-71s\t%-11v\t%s\t\n", id, !di.InUse, size)
133+
lastAccessed := ""
134+
if di.LastUsedAt != nil {
135+
lastAccessed = di.LastUsedAt.Local().Format("2006-01-02 15:04:05")
136+
}
137+
fmt.Fprintf(tw, "%-71s\t%-11v\t%s\t%s\t%d\n", id, !di.InUse, size, lastAccessed, di.UsageCount)
134138
}
135139

136140
func printSummary(tw *tabwriter.Writer, du []*client.UsageInfo) {

0 commit comments

Comments
 (0)