Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface { // Running must return true when the command is still running. Running() bool // Exec takes command program with first param, then arguments. Exec(params ...string) error }
Executor provides a minimal workflow to run commands.
func NewPrintExec ¶
NewPrintExec only prints to stdout the full file path that triggered an event so you can pipe the output and do whatever you want with it.
func NewRawExec ¶
NewRawExec will run your command without shell. FIXME: commands with arguments are NOT supported for now.
func NewUnixShellExec ¶
NewUnixShellExec returns an executor that will run your command through /bin/sh -c "<command>". Your command will be quoted before to avoid any problems.
type Watcher ¶
type Watcher struct { Name string Command string Match string Filter string FSWatcher *fsnotify.Watcher Shell string Debug bool Logger *log.Logger // contains filtered or unexported fields }
Watcher ...
func NewWatcher ¶
func NewWatcher(name, match, filter, command string, executor Executor, debug bool, logger *log.Logger) (*Watcher, error)
NewWatcher requires logger and executor to not be nil. param name is purely cosmetic, for logs. param match is a file, directory or "glob" path (shell-like). param command is a single command to run through executor. param executor is an instance of Executor that is not required to honor the given command, like for the Print executor. param debug shows more details when running. param logger must log to stderr when using executor Print.