9 "github.com/dustin/go-humanize"
12 func printerSimple(ents chan Ent) {
13 for ent := range ents {
14 fmt.Println(nameJoin(ent.name))
18 func printerMachine(ents chan Ent) {
19 for ent := range ents {
21 strconv.FormatUint(uint64(ent.size), 10),
22 time.Unix(int64(ent.mtime), 0).Format("2006-01-02T15:04:05"),
28 type TreePrintEnt struct {
33 func laster(ents chan Ent, trees chan TreePrintEnt) {
35 for ent := range ents {
36 tree := TreePrintEnt{ent: entPrev}
37 if len(ent.name) < len(entPrev.name) {
43 trees <- TreePrintEnt{ent: entPrev}
47 func printerTree(ents chan Ent) {
48 trees := make(chan TreePrintEnt, 1<<10)
49 go laster(ents, trees)
52 for ent := range trees {
55 "%s\t[%s]\n", nameJoin(ent.ent.name),
56 humanize.IBytes(uint64(ent.ent.size)),
66 fmt.Printf("%s%s %s\t[%s] %s\n",
67 strings.Repeat("│ ", len(ent.ent.name)-2), box,
68 nameJoin(ent.ent.name), humanize.IBytes(uint64(ent.ent.size)),
69 time.Unix(ent.ent.mtime, 0).Format("2006-01-02"),