Skip to content

Commit

Permalink
Display all event detection messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimafisk committed May 1, 2020
1 parent 9e0b8a0 commit 536aebb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,16 @@ func Watch(buildPath string) {
}
case <-ticker.C:
if len(events) > 0 {
if events[len(events)-1].Op&fsnotify.Write == fsnotify.Write {
fmt.Printf("\nFile write detected: %#v\n", events[len(events)-1])
}
if events[len(events)-1].Op&fsnotify.Remove == fsnotify.Remove {
fmt.Printf("\nFile delete detected: %#v\n", events[len(events)-1])
}
if events[len(events)-1].Op&fsnotify.Rename == fsnotify.Rename {
fmt.Printf("\nFile rename detected: %#v\n", events[len(events)-1])
for _, event := range events {
if event.Op&fsnotify.Write == fsnotify.Write {
fmt.Printf("\nFile write detected: %#v\n", event)
}
if event.Op&fsnotify.Remove == fsnotify.Remove {
fmt.Printf("\nFile delete detected: %#v\n", event)
}
if event.Op&fsnotify.Rename == fsnotify.Rename {
fmt.Printf("\nFile rename detected: %#v\n", event)
}
}
Build()
events = make([]fsnotify.Event, 0)
Expand Down

0 comments on commit 536aebb

Please sign in to comment.