Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit edd2139

Browse files
committed
Always use 2 decimals
1 parent 9c96344 commit edd2139

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

commands/df.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func diskUsageTable(df desktop.DiskUsage) string {
4646
})
4747
table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
4848

49-
table.Append([]string{"Models", units.HumanSize(float64(df.ModelsDiskUsage))})
49+
table.Append([]string{"Models", units.CustomSize("%.2f%s", float64(df.ModelsDiskUsage), 1000.0, []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"})})
5050
if df.DefaultBackendDiskUsage != 0 {
51-
table.Append([]string{"Inference engine", units.HumanSize(float64(df.DefaultBackendDiskUsage))})
51+
table.Append([]string{"Inference engine", units.CustomSize("%.2f%s", float64(df.DefaultBackendDiskUsage), 1000.0, []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"})})
5252
}
5353

5454
table.Render()

desktop/desktop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (c *Client) Pull(model string, progress func(string)) (string, bool, error)
155155
current += layerCurrent
156156
}
157157

158-
progress(fmt.Sprintf("Downloaded %s of %s", units.HumanSize(float64(current)), units.HumanSize(float64(progressMsg.Total))))
158+
progress(fmt.Sprintf("Downloaded %s of %s", units.CustomSize("%.2f%s", float64(current), 1000.0, []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}), units.CustomSize("%.2f%s", float64(progressMsg.Total), 1000.0, []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"})))
159159
progressShown = true
160160
case "error":
161161
return "", progressShown, fmt.Errorf("error pulling model: %s", progressMsg.Message)

0 commit comments

Comments
 (0)