file counter improved

This commit is contained in:
alessio 2016-08-23 13:10:43 +02:00
parent e2a637065d
commit 6b84e34f2c
1 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,7 @@ func (p *Project) watching() {
var wr sync.WaitGroup var wr sync.WaitGroup
var watcher *fsnotify.Watcher var watcher *fsnotify.Watcher
var counter int64 var files, folders int64
watcher, err := fsnotify.NewWatcher() watcher, err := fsnotify.NewWatcher()
if err != nil { if err != nil {
log.Println(strings.ToUpper(pname(p.Name, 1)), ":", Red(err.Error())) log.Println(strings.ToUpper(pname(p.Name, 1)), ":", Red(err.Error()))
@ -85,7 +85,9 @@ func (p *Project) watching() {
return filepath.SkipDir return filepath.SkipDir
} }
if inArray(filepath.Ext(path), p.Watcher.Exts) { if inArray(filepath.Ext(path), p.Watcher.Exts) {
counter++ files++
} else {
folders++
} }
} }
} }
@ -114,7 +116,7 @@ func (p *Project) watching() {
} }
} }
fmt.Println(Red("Watching: "), pname(p.Name, 1), Magenta(counter), "files \n") fmt.Println(Red("Watching: "), pname(p.Name, 1), Magenta(files), "files", Magenta(folders), "folders \n")
go routines(p, channel, &wr) go routines(p, channel, &wr)
p.reload = time.Now().Truncate(time.Second) p.reload = time.Now().Truncate(time.Second)