Automatically execute command when file is modified
Go to file
nikobojs afd2cee62a updated README.md 2019-11-02 12:31:27 +01:00
.gitignore initial commit 2019-11-02 12:28:31 +01:00
LICENSE.md initial commit 2019-11-02 12:28:31 +01:00
README.md updated README.md 2019-11-02 12:31:27 +01:00
filewatch.go initial commit 2019-11-02 12:28:31 +01:00

README.md

Filewatch

Automatically execute command when file is modified

Description

Filewatch listens to all files with a filename that matches a regular expression. It spawns a new goroutine for each file it listens to. Each goroutine loops every second and executes a command if the file is modified.

Installing

  • Install Go
  • git clone git.nikobojs.com/nikobojs/filewatch
  • go build filewatch.go

Run program

  • First argument is the regular expression
  • The rest of the arguments will be executed when files are modified
  • Keyword {fname} can be used for injecting filename into the command
  • usage: ./filewatch [regex] [command]
  • example: ./filewatch '.+\\.go' go fmt {fname}

License

This project is licensed under the MIT License - see the LICENSE.md file for details