summaryrefslogtreecommitdiffstats
path: root/tui/format.go
diff options
context:
space:
mode:
authorDaniel Milde <daniel@milde.cz>2021-03-02 11:27:29 +0100
committerDaniel Milde <daniel@milde.cz>2021-03-02 23:14:37 +0100
commit042082c8c4d93c3392ca101015999ad72ff57c4a (patch)
tree3a000d3e4c8f9c8db8421c5b68f9db20cf8325b8 /tui/format.go
parent6d50a986db34498810b622a933502c42431a2a47 (diff)
analyze structs refactored
uses 20% less memory
Diffstat (limited to 'tui/format.go')
-rw-r--r--tui/format.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/tui/format.go b/tui/format.go
index 1eab1e6..73d4a84 100644
--- a/tui/format.go
+++ b/tui/format.go
@@ -7,16 +7,16 @@ import (
"github.com/dundee/gdu/v4/analyze"
)
-func (ui *UI) formatFileRow(item *analyze.File) string {
+func (ui *UI) formatFileRow(item analyze.Item) string {
var part int
if ui.showApparentSize {
- part = int(float64(item.Size) / float64(item.Parent.Size) * 10.0)
+ part = int(float64(item.GetSize()) / float64(item.GetParent().GetSize()) * 10.0)
} else {
- part = int(float64(item.Usage) / float64(item.Parent.Usage) * 10.0)
+ part = int(float64(item.GetUsage()) / float64(item.GetParent().GetUsage()) * 10.0)
}
- row := string(item.Flag)
+ row := string(item.GetFlag())
if ui.useColors {
row += "[#e67100:-:b]"
@@ -25,21 +25,21 @@ func (ui *UI) formatFileRow(item *analyze.File) string {
}
if ui.showApparentSize {
- row += fmt.Sprintf("%21s", ui.formatSize(item.Size, false, true))
+ row += fmt.Sprintf("%21s", ui.formatSize(item.GetSize(), false, true))
} else {
- row += fmt.Sprintf("%21s", ui.formatSize(item.Usage, false, true))
+ row += fmt.Sprintf("%21s", ui.formatSize(item.GetUsage(), false, true))
}
row += getUsageGraph(part)
- if item.IsDir {
+ if item.IsDir() {
if ui.useColors {
row += "[#3498db::b]/"
} else {
row += "[::b]/"
}
}
- row += item.Name
+ row += item.GetName()
return row
}