Documentation
¶
Overview ¶
Package watch provides file system watching with debouncing for convertr watch mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleDeletion ¶
func HandleDeletion(outPath string, policy DeletePolicy) error
HandleDeletion applies the delete policy for srcPath whose output lives at outPath.
Types ¶
type Config ¶
type Config struct {
Debounce time.Duration // how long to wait after last event before emitting
DeletePolicy DeletePolicy
}
Config holds watcher options.
type DeletePolicy ¶
type DeletePolicy int
DeletePolicy controls what happens to the output file when the source is deleted.
const ( DeleteKeep DeletePolicy = iota // leave output file as-is DeleteRemove // remove corresponding output file DeleteArchive // move output file to .archive/ subdirectory )
func ParseDeletePolicy ¶
func ParseDeletePolicy(s string) (DeletePolicy, error)
ParseDeletePolicy parses a string delete policy name.
type Event ¶
type Event struct {
Path string // absolute path of changed file
}
Event is emitted when a file should be (re)converted.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches a directory tree and emits debounced Events on changes.
func New ¶
New creates a Watcher that emits to the returned channel. The caller must call Close to release resources.
Click to show internal directories.
Click to hide internal directories.