watchf

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2015 License: MIT Imports: 14 Imported by: 1

README

Watchf

Build Status

Watchf is a tool for watching directory changes and run commands

Installation

  1. install Go into your environment
  2. install watchf
go get github.com/parkghost/watchf/...

Usage

Usage:
  watchf [options]

Options:
  -V=false: Show debugging messages
  -c=[]: Add arbitrary command (repeatable)
  -e=[all]: Listen for specific event(s) (comma separated list)
  -exclude=".watchf.conf|.git|.pid": Do not process any events whose file name matches specified regular expression pattern (perl-style)
  -f=".watchf.conf": Specifies a configuration file
  -i=100ms: The interval limit the frequency of the command executions, if equal to 0, there is no limit (time unit: ns/us/ms/s/m/h)
  -include=".*": Process any events whose file name matches file name matches specified regular expression pattern (perl-style)
  -r=false: Watch directories recursively
  -w=false: Write command-line arguments to configuration file (write and exit)

Events:
     all  Create/Write/Remove/Rename/Chmod
  create  File/directory created in watched directory
  write   File written in watched directory
  remove  File/directory deleted from watched directory
  rename  File moved out of watched directory
  chmod   File Metadata changed

Variables:
      %f  The filename of changed file
      %t  The event type of file changes

Example 1:
  watchf -e "write,remove,create" -c "go test" -c "go vet" -include ".go$"
Example 2(with custom variable):
  watchf -c "process.sh %f %t"
Example 3(with configuration file):
  watchf -e "write,remove,create" -c "go test" -c "go vet" -include ".go$" -w
  watchf

Screenshot

Screenshot

Binaries

Link

License

This project is licensed under the MIT license

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.5.0

type Action interface {
	Run() StepOp
}

type BasicRunner added in v0.5.0

type BasicRunner struct {
	Context context.Context
}

func (BasicRunner) Run added in v0.5.0

func (r BasicRunner) Run(actions ...Action)

type Handler added in v0.5.0

type Handler interface {
	Handle(context.Context, fsnotify.Event)
}

func NewLimitedHandler added in v0.5.0

func NewLimitedHandler(cfg *config.Config) Handler

type Runner added in v0.5.0

type Runner interface {
	Run(...Action)
}

type StepOp added in v0.5.0

type StepOp int
const (
	Halt StepOp = iota
	Continue
)

type WatchService

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

func New added in v0.5.0

func New(ctx context.Context, cfg *config.Config, path string, handler Handler) (*WatchService, error)

func (*WatchService) Start

func (ws *WatchService) Start() error

func (*WatchService) Stop

func (ws *WatchService) Stop() error

Directories

Path Synopsis
cmd
watchf command

Jump to

Keyboard shortcuts

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