Moved package fetching, installation and removal functionality to operations.go

This commit is contained in:
2024-10-17 11:54:32 +03:00
parent a7b025d92d
commit 918ff984ca
4 changed files with 294 additions and 294 deletions
+12 -1
View File
@@ -49,7 +49,18 @@ func stringSliceRemove(s []string, r string) []string {
return s
}
func BytesToHumanReadable(b uint64) string {
func UnsignedBytesToHumanReadable(b uint64) string {
bf := float64(b)
for _, unit := range []string{"", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"} {
if math.Abs(bf) < 1024.0 {
return fmt.Sprintf("%3.1f%sB", bf, unit)
}
bf /= 1024.0
}
return fmt.Sprintf("%.1fYiB", bf)
}
func BytesToHumanReadable(b int64) string {
bf := float64(b)
for _, unit := range []string{"", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"} {
if math.Abs(bf) < 1024.0 {