progress: fix bar rate

This commit is contained in:
Michael Yang 2023-11-18 16:23:03 -08:00
parent e1a69d44c9
commit 424d53ac70
3 changed files with 125 additions and 81 deletions

View file

@ -37,6 +37,8 @@ func HumanBytes(b int64) string {
switch {
case value >= 100:
return fmt.Sprintf("%d %s", int(value), unit)
case value >= 10:
return fmt.Sprintf("%d %s", int(value), unit)
case value != math.Trunc(value):
return fmt.Sprintf("%.1f %s", value, unit)
default: