mirror of
https://github.com/wagoodman/dive
synced 2026-03-17 07:45:49 +01:00
dont show inefficiencies breakdown when there are none
This commit is contained in:
parent
18b405db72
commit
4e7e9b64e3
1 changed files with 5 additions and 0 deletions
|
|
@ -73,15 +73,20 @@ func (view *DetailsView) Render() error {
|
|||
var wastedSpace int64
|
||||
|
||||
template := "%5s %12s %-s\n"
|
||||
var trueInefficiencies int
|
||||
inefficiencyReport := fmt.Sprintf(Formatting.Header(template), "Count", "Total Space", "Path")
|
||||
for idx := len(view.inefficiencies)-1; idx > 0; idx-- {
|
||||
data := view.inefficiencies[idx]
|
||||
if data.CumulativeSize == 0 {
|
||||
continue
|
||||
}
|
||||
trueInefficiencies++
|
||||
wastedSpace += data.CumulativeSize
|
||||
inefficiencyReport += fmt.Sprintf(template, strconv.Itoa(len(data.Nodes)), humanize.Bytes(uint64(data.CumulativeSize)), data.Path)
|
||||
}
|
||||
if trueInefficiencies == 0 {
|
||||
inefficiencyReport = ""
|
||||
}
|
||||
|
||||
effStr := fmt.Sprintf("\n%s %d %%", Formatting.Header("Image efficiency score:"), int(100.0*view.efficiency))
|
||||
spaceStr := fmt.Sprintf("%s %s\n", Formatting.Header("Potential wasted space:"), humanize.Bytes(uint64(wastedSpace)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue