Skip to content
/ watcher Public

Go live reload program for Linux (.gitignore aware)

License

Notifications You must be signed in to change notification settings

sipkg/watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watcher is a Go live reload or retest program for Linux.

Watcher monitors the files in a directory and all its subfolders. If a write or delete event occurs on any file, the Go program or the tests are reloaded.

If a .gitignore file is present, Watcher will use it to exclude files from monitoring. Use .watcherignore file to add patterns to ignore that can not be added to .gitignore.

Watcher also accepts to pass arguments to the program via the args flag. Arguments must be surrounded with quotes.

Usage

  • -dir path folder to watch (default current folder)
  • -run prog program to run (default empty)
  • -args "arguments..." pass arguments to the program (default empty). This has no effect with -test.
  • -test launch tests instead of the program
  • -help view the command usage

Examples

Watch the current folder (default) and run the program in ./cmd/server with some arguments (note the quotes)

watcher -run ./cmd/server/ -args "-name John -age 24"

Watch folder ./pkg and run the program in ./cmd/server

watcher -run ./cmd/server -dir ./pkg

Watch current folder and retest

watcher -test

Watch current folder and retest all subfolders

watcher -test -run ./...

Example of a .watcherignore file

$ cat .watcherignore
.watcherignore
.git
cmd/client
*.md
*.yml
*.sh
*.mod
*.sum
Makefile

About

Go live reload program for Linux (.gitignore aware)

Resources

License

Stars

Watchers

Forks