watcher

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *Watcher)

func WithBreakOnError added in v0.0.14

func WithBreakOnError(breakOnError bool) Option

func WithMask

func WithMask(masks ...string) Option

func WithPaths

func WithPaths(paths ...string) Option

func WithRemoveCallback

func WithRemoveCallback(callback RemoveCallback) Option

func WithWriteCallback

func WithWriteCallback(callback WriteCallback) Option

type RemoveCallback

type RemoveCallback func(path string) error

type Watcher

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

Watcher provides a way to recursively watch a set of paths for changes. It recursively adds all directories present (and created in the future) to provide coverage.

You can provide a doublestar mask to filter out paths. For example, to only watch for changes to .txt files, you can provide "**/*.txt".

func NewWatcher

func NewWatcher(options ...Option) *Watcher

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context) error

Run is a blocking loop that will watch the paths provided and call the

type WriteCallback

type WriteCallback func(path string) error

Jump to

Keyboard shortcuts

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