file

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Op                Op
	Path              string
	LastKnownChecksum string
	// contains filtered or unexported fields
}

Event decsribes a file change event

type Filter

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

Filter matches filepaths to a list of patterns

func NewFilter

func NewFilter(rootDir string, patterns []string, files []string) (Filter, error)

NewFilter will create a new file path filter

func (Filter) Match

func (f Filter) Match(path string) bool

Match will return true if the file path has matched a pattern in this filter

type Op

type Op int

Op describes the different types of file operations

const (
	// Update is a file op where the file is updated
	Update Op = iota
	// Remove is a file op where the file is removed
	Remove
	// Skip is a file op where the remote file matches the local file so is not transferred
	Skip
	// Get is when a file should be re-fetched, used in download operations
	Get
)

type Watcher

type Watcher struct {
	Events chan Event
	// contains filtered or unexported fields
}

Watcher is the object used to watch files for change and notify on any events, these events can then be passed along to kit to be sent to shopify.

func NewWatcher

func NewWatcher(e *env.Env, configPath string, checksums map[string]string) (*Watcher, error)

NewWatcher will create a new file change watching for a given directory defined in an environment

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop will stop the Watcher from watching it's directories and clean up any go routines doing work.

func (*Watcher) Watch

func (w *Watcher) Watch()

Watch will start the watcher actually receiving file change events and sending events to the Events channel

Jump to

Keyboard shortcuts

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