diff options
author | Daniel Milde <daniel@milde.cz> | 2024-04-24 16:07:12 +0200 |
---|---|---|
committer | Daniel Milde <daniel@milde.cz> | 2024-04-24 16:07:50 +0200 |
commit | cf98385b1e09bfa41bc567ad0686cf0fe9f4b259 (patch) | |
tree | 16a75d7fb9fc98141eb2e83e621d272022662a0b /tui/format.go | |
parent | 4ed4f05d572e6f8f7d54becf2592fbac7ff4cac7 (diff) |
refactor: if-else to switch
Diffstat (limited to 'tui/format.go')
-rw-r--r-- | tui/format.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tui/format.go b/tui/format.go index 001c004..03d4460 100644 --- a/tui/format.go +++ b/tui/format.go @@ -24,11 +24,12 @@ const ( func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, ignored bool) string { var part int - if ignored { + switch { + case ignored: part = 0 - } else if ui.ShowApparentSize { + case ui.ShowApparentSize: part = int(float64(item.GetSize()) / float64(maxSize) * 100.0) - } else { + default: part = int(float64(item.GetUsage()) / float64(maxUsage) * 100.0) } |