rerun

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 8 Imported by: 0

README

rerun: Re-run command on file system changes

Lightweight file-watcher that re-runs given command on FS changes. It has simple CLI and optional config file. By default, it uses 200ms delay, which gives enough time for tools like git to update all directories/files within repository before killing the old process (when you switch branches etc).

In development. Only CLI MVP works right now.

Usage

rerun [-watch DIR...] [-ignore DIR...] -run COMMAND [ARG...]
Examples:
$ rerun -watch ./ -ignore vendor bin -run go run ./cmd/rerun/main.go
$ rerun -watch ./ -ignore vendor bin -run sh -c 'go build -i -o ./bin/rerun ./cmd/rerun/main.go && ./bin/rerun'
$ cd tests && rerun -watch '*_test.go' ../pkg -ignore vendor bin -run go test -run=Test

Installation

go get -u github.com/VojtechVitek/rerun/cmd/rerun

You might need to download Go first.

TODO: Release page.

TODO

  • Versioning + Releases
  • Regexp matches
  • Verbose mode
  • Interactive mode
  • Config file, as an alternative to direct CLI invocation
  • Act when a new dir is added/removed
  • Support Windows
api:
  watch:
    - cmd
    - *.go
  ignore:
    - bin
    - *_test.go
  cmd:
    - go run cmd/api/main.go -flags args

test-login:
  name: Test login
  watch:
    - tests/e2e
    - services/auth
    - data
  run:
    - go test -run=Login

Written in golang.

Uses fsnotify behind the scenes, so technically it should work on most platforms including Linux, Mac OS and Windows.

License

Licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {
	Files map[string]struct{}
	Error error
}

func (*ChangeSet) String

func (c *ChangeSet) String() string

type Cmd

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

func StartCommand

func StartCommand(args ...string) (*Cmd, error)

func (*Cmd) Kill

func (c *Cmd) Kill() error

func (*Cmd) PID

func (c *Cmd) PID() string

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) String

func (c *Cmd) String() string

func (*Cmd) Wait

func (c *Cmd) Wait() error

type Watcher

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

func NewWatcher

func NewWatcher() (*Watcher, error)

func (*Watcher) Add

func (w *Watcher) Add(paths ...string)

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) Ignore

func (w *Watcher) Ignore(paths ...string)

func (*Watcher) Watch

func (w *Watcher) Watch(delay time.Duration) <-chan ChangeSet

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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