Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exact sizes #375

Open
3052 opened this issue Aug 2, 2024 · 2 comments
Open

exact sizes #375

3052 opened this issue Aug 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@3052
Copy link

3052 commented Aug 2, 2024

is it possible to show exact sizes instead of human sizes?

@3052
Copy link
Author

3052 commented Aug 2, 2024

I found another tool which also does human size, but it has an extra decimal place

https://github.com/Byron/dua-cli

   1.66 KiB byte-byte
   1.70 KiB string-byte
   1.48 MiB dua.exe
   1.49 MiB total

@3052
Copy link
Author

3052 commented Aug 2, 2024

looks like the precision is hardcoded

gdu/tui/format.go

Lines 139 to 158 in 076d30e

func formatWithBinPrefix(fsize float64, color string) string {
asize := math.Abs(fsize)
switch {
case asize >= common.Ei:
return fmt.Sprintf("%.1f%s EiB", fsize/common.Ei, color)
case asize >= common.Pi:
return fmt.Sprintf("%.1f%s PiB", fsize/common.Pi, color)
case asize >= common.Ti:
return fmt.Sprintf("%.1f%s TiB", fsize/common.Ti, color)
case asize >= common.Gi:
return fmt.Sprintf("%.1f%s GiB", fsize/common.Gi, color)
case asize >= common.Mi:
return fmt.Sprintf("%.1f%s MiB", fsize/common.Mi, color)
case asize >= common.Ki:
return fmt.Sprintf("%.1f%s KiB", fsize/common.Ki, color)
default:
return fmt.Sprintf("%d%s B", int64(fsize), color)
}
}

@dundee dundee added the enhancement New feature or request label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants