watcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Source: https://github.com/workshop-depot/dirwatch

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name string
	Op   fsnotify.Op
}

Event represents a single file system notification.

func (*Event) Is

func (e *Event) Is(ops ...fsnotify.Op) bool

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

func NewMatcher

func NewMatcher(pattern []string) Matcher

func (*Matcher) Match

func (m *Matcher) Match(filePath string) bool

type Option

type Option func(*options)

Option modifies the options.

func Exclude

func Exclude(exclude ...string) Option

Exclude sets patterns to exclude from watch.

func Logger

func Logger(logger func(args ...interface{})) Option

Logger sets the logger for the watcher.

func Notify

func Notify(notify func(Event)) Option

Notify sets the notify callback.

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher watches over a directory and it's sub-directories, recursively.

func New

func New(opt ...Option) *Watcher

New creates a new *Watcher. Excluded patterns are based on filepath.Match function patterns.

func (*Watcher) Add

func (dw *Watcher) Add(path string, recursive bool)

Add adds a path to be watched.

func (*Watcher) Stop

func (dw *Watcher) Stop()

Stop stops the watcher. Safe to be called mutiple times.

Jump to

Keyboard shortcuts

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