Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { Name string `yaml:"name,omitempty"` Patterns stringArr `yaml:"pattern,omitempty"` ExcludePatterns stringArr `yaml:"exclude,omitempty"` BuildCommands stringArr `yaml:"build,omitempty"` RunCommand string `yaml:"run,omitempty"` }
Action is a block in a Config file
type BuildFunc ¶
type BuildFunc func() error
BuildFunc is a function that is executed before a RunFunc
func BuildCommand ¶
BuildCommand returns a BuildFunc that can execute a command with arguments.
type Config ¶
type Config struct { Dir string `yaml:"dir,omitempty"` ExcludeDirs stringArr `yaml:"excludeDir,omitempty"` Interval time.Duration `yaml:"interval,omitempty"` Actions []Action `yaml:"action"` }
Config holds all the configuration for running revolver.
func ParseFlags ¶
ParseFlags parses a Config from command line flags, validates it and sets the default values. If no build(b) or run(r) flags are found it will parse the config from a yaml file based on the configFile(c) flag.
type DetectFunc ¶
type DetectFunc func() []string
DetectFunc detects changes in a filesystem and returns the changed files.
func Detect ¶
func Detect(dir string, excludeDirs []string) DetectFunc
Detect returns a DetectFunc that will walk the filesystem from the given dir recursively, skipping the excludeDirs and return the changed files.
type FilterFunc ¶
FilterFunc can filter files.
func Filter ¶
func Filter(includePatterns, excludePatterns []string) FilterFunc
Filter returns a FilterFunc that can filter files based on include and exclude patterns.
type RunFunc ¶
type RunFunc func() (stop func(), err error)
RunFunc is a function that runs like a daemon and can be stopped with the returned stop function.
func RunCommand ¶
RunCommand returns a RunFunc that can start a command line app with arguments. It returns a function that can kill the started process.