In the last couple of months I’ve been playing a lot with Go and did what I always do when learning a new language: use it for a small project. That project has been open to the public on GitHub for a few weeks now and is now in a usable state: Watchgopher.
Watchgopher allows you to watch certain directories and run custom commands whenever a file in a specified directory changes. It is supposed to be simple and give you control of what happens to your files: it only notifies one of your commands whenever something happens it should know about.
Let me guide you through a simple example to show you what Watchgopher can do. But first, make sure you have Go installed and then run the following command to install Watchgopher on your system:
1
| |
Now the watchgopher command should be available on your system and it’s time
to tell Watchgopher which directories to watch and what to do about any file
events occurring in them. So let’s create a simple configuration file in JSON
format: