diskspace/stats.go

35 lines
530 B
Go
Raw Normal View History

2022-06-28 13:11:16 +02:00
package main
import (
"strings"
)
type RemovalStats struct {
Files int
Dirs int
Bytes uint64
Paths []string
}
func (s *RemovalStats) String() string {
b := new(strings.Builder)
for _, path := range s.Paths {
b.WriteString(path)
b.WriteRune('\n')
}
b.WriteRune('\n')
b.WriteString(Translate("Files: %d", s.Files))
b.WriteRune('\n')
b.WriteString(Translate("Directories: %d", s.Dirs))
b.WriteRune('\n')
b.WriteString(Translate("Total size: %s", fmtSize(s.Bytes)))
b.WriteRune('\n')
return b.String()
}