watcher

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(dir string, matchFiles, ignore *regexp.Regexp, verbose bool) (w *Watcher, err error)

New creates a watcher, watching all files and directories inside dir (recursively) If matchFiles is not nil, only the files matching matchFiles are respected. If ignore is not nil, files and directories matching ignore are ignored. An error is returned if the watcher could not be properly initialized.

func (*Watcher) Run

func (w *Watcher) Run(filechanged chan<- string, errors chan<- error)

Run runs the watching loop, reporting any errors to the errors channel, file modification and creation to the filechanged channel and file deletion and file renaming to the dirchanged channel for removal and renamed files, an empty filename is added to filechanged, since the command could not do anything meaningful with the missing file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL