mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Show installed size for binary packages
This commit is contained in:
+12
-1
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -280,7 +281,7 @@ func (entry *BPMDatabaseEntry) GetEntryDependants() (dependants []string) {
|
||||
return dependants
|
||||
}
|
||||
|
||||
func (entry *BPMDatabaseEntry) CreateReadableInfo(rootDir string) string {
|
||||
func (entry *BPMDatabaseEntry) CreateReadableInfo(rootDir string, humanReadableSize bool) string {
|
||||
ret := make([]string, 0)
|
||||
appendArray := func(label string, array []string, sort bool) {
|
||||
if len(array) == 0 {
|
||||
@@ -346,5 +347,15 @@ func (entry *BPMDatabaseEntry) CreateReadableInfo(rootDir string) string {
|
||||
}
|
||||
ret = append(ret, "Installation Reason: "+installationReasonString)
|
||||
}
|
||||
if entry.Info.Type == "binary" {
|
||||
installedSize := int64(entry.InstalledSize)
|
||||
var installedSizeStr string
|
||||
if humanReadableSize {
|
||||
installedSizeStr = bytesToHumanReadable(installedSize)
|
||||
} else {
|
||||
installedSizeStr = strconv.FormatInt(installedSize, 10)
|
||||
}
|
||||
ret = append(ret, "Installed size: "+installedSizeStr)
|
||||
}
|
||||
return strings.Join(ret, "\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user