35 lines
530 B
Go
35 lines
530 B
Go
|
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()
|
||
|
}
|