watch

package
v0.0.0-...-4db743b Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

README

GoDoc

gulf/task/watch

Task management system extended to react to filesystem events.

Documentation

Overview

Package watch implements filesystem event based execution of tasks atop gulf/task.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(s *Set) error

The Option type is a function that modifies a Watch.

func Delay

func Delay(d time.Duration) Option

Delay sets the delay used by Watch to identify unique file events. All file events on a single file name (not inode) that take place within d time of each other will be considered a single file event by Watch. This is a debouncing mechanism, provided to trigger tasks only once despite most text editor's usage of multiple file events while writing a file.

The default is 10 milliseconds

func Globber

func Globber(fn func(string) ([]string, error)) Option

Globber sets the globbing function used by the Set to identify files to watch.

The default is glob.Glob

func Matcher

func Matcher(fn func(string, string) (bool, error)) Option

Matcher sets the matching function used by the Set to assert that events on a file should trigger tasks.

The default is glob.Match

type Set

type Set struct {
	*task.Set
	// contains filtered or unexported fields
}

The Set type embeds a task.Set and extends it with the ability to execute tasks based on filesystem events.

func New

func New() *Set

New returns a new Set, initialized to use glob.Match and glob.Glob.

func (*Set) SetOption

func (s *Set) SetOption(opts ...Option) error

SetOption modifies s with Options provided.

func (*Set) Start

func (s *Set) Start() error

Start begins watching all of the directories containing files added to s.

func (*Set) Watch

func (s *Set) Watch(patterns []string, tasks ...string)

Watch adds a set of tasks to the list that will be executed when any of the provided patterns are matched.

Jump to

Keyboard shortcuts

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