-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstats.go
70 lines (54 loc) · 1.07 KB
/
stats.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main
type Stats struct {
SkipCount int64
SkipFiles []string
DelCount int64
DelFiles []string
MkCount int64
MkFiles []string
ErrCount int64
ErrFiles []string
}
func (s *Stats) TotalFiles() int64 {
return s.SkipCount + s.MkCount + s.ErrCount
}
func (s *Stats) AllFiles() []string {
fList := []string{}
for _, f := range s.SkipFiles {
fList = append(fList, f)
}
for _, f := range s.DelFiles {
fList = append(fList, f)
}
for _, f := range s.MkFiles {
fList = append(fList, f)
}
for _, f := range s.ErrFiles {
fList = append(fList, f)
}
return fList
}
func (s *Stats) AddSkip(f string) {
s.SkipCount++
s.SkipFiles = append(s.SkipFiles, f)
}
func (s *Stats) AddDel(f string) {
s.DelCount++
s.DelFiles = append(s.DelFiles, f)
}
func (s *Stats) AddMk(f string) {
s.MkCount++
s.MkFiles = append(s.MkFiles, f)
}
func (s *Stats) AddErr(f string) {
s.ErrCount++
s.ErrFiles = append(s.ErrFiles, f)
}
func NewStats() *Stats {
return &Stats{
SkipFiles: []string{},
DelFiles: []string{},
MkFiles: []string{},
ErrFiles: []string{},
}
}