A small CLI tool that watches folders or files for modifications like added, changed or deleted files. It then sends a notification to a specific endpoint, e.g. a Slack channel, an URL (HTTP request) or execute a command.
It makes use of the github.com/rjeczalik/notify Go library to provide cross-platform filesystem notifications.
Fofiwano is available as pre-built binaries for macOS, Linux, FreeBSD and Windows on the release page.
Create a config file .fofiwano.yml in the current directory or in your $HOME with content like this (see example):
watching:
# recursive watching ./test
- target: ./test/...
notifications:
- notify: slack
event: all
options:
channel: "#test"
username: "fofiwano"
webhook_url: "https://hooks.slack.com/services/..."
icon_emoji: ":monkey_face:"
footer: "fofiwano"
- notify: http
event: write
options:
URL: http://my.endpoint.com
# only watching ./test2 and NO sub-folders
- target: ./test2
notifications:
- notify: http
event: write
options:
URL: http://test.com
targetcan be a single file or a folder. Add/...to a folder to create a recursive watcher that also reacts to modifications in sub-folders.`notificationsis an array of notification providers with their options. Right now only Slack and HTTP (GET) notifications are available! (more to come).eventcan be one ofall,write,create,removeorrename
Hint: You don't have to stick with YAML if you don't like it. You can write your config in every format that Viper supports (JSON, TOML, YAML, HCL, and Java properties config files).
Start your watcher like so:
fofiwano watchYou can also provide the path to your config file with the --config flag:
fofiwano --config ~/.fofiwano.yml watchGet help about all available flags and commands:
fofiwano --helpAvailable options:
channel: "#test"
username: "fofiwano"
webhook_url: "https://hooks.slack.com/services/..."
icon_emoji: ":monkey_face:"
footer: "fofiwano"Available options:
URL: "http://my.endpoint.com"
method: "GET" # GET or POST
param_event: "event" # parameter name for event
param_path: "param" # parameter name for pathGET and POST is supported.
For GET the given URL will be called with the following paramter names:
http://my.endpoint.com?event=notify.rename&path=/home/myname/files/test.txt
For POST endpoints a JSON with the following content is sent as body:
{
"event": "notify.rename",
"path": "/home/myname/files/test.txt"
}- add more notification providers (command execution)
- add templates for fine grained control over notification messages
- add queue for notification events to prevent locks
- add tests
Tools with similar functionality: