-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (33 loc) · 838 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"log"
"time"
"github.com/valdotle/mangopeeler/internal"
)
func main() {
setupFlags()
setupLogs()
defer closeLogs()
if err := initialize(); err != nil {
log.Panicf("failed to load images to match against, error:\n%s", err.Error())
}
log.Println("mangopeeler initialized successfully")
go progress()
walker(options.Dir)
log.Printf("\nscanned %d entries (including %d images) in %s with %d entries matching search criteria%s", totalReads.Load(), imagesRead.Load(), time.Since(start).String(), dirEntriesFound.Load(), func() string {
if options.Delete {
return " removed"
}
return ""
}())
}
var limit internal.Pool
func walker(path string) {
if dirThreaded {
limit = internal.NewPool(options.Threads, processDir)
limit.Add(path)
limit.Finish()
} else {
processDir(path)
}
}