diff --git a/README.md b/README.md index a9e0db7..9fd868e 100644 --- a/README.md +++ b/README.md @@ -28,22 +28,3 @@ Listens on filesystem changes and forwards received events to user-defined handl *Documentation* [godoc.org/github.com/rjeczalik/notify/cmd/notify](https://godoc.org/github.com/rjeczalik/notify/cmd/notify) - -*Usage* - -``` -~ $ notify -c 'echo "Hello from handler! (event={{.Event}}, path={{.Path}})"' -2015/02/17 01:17:40 received notify.Create: "/Users/rjeczalik/notify.tmp" -Hello from handler! (event=create, path=/Users/rjeczalik/notify.tmp) -... -``` -``` -~ $ cat > handler < echo "Hello from handler! (event={{.Event}}, path={{.Path}})" -> EOF - -~ $ notify -f handler -2015/02/17 01:22:26 received notify.Create: "/Users/rjeczalik/notify.tmp" -Hello from handler! (event=create, path=/Users/rjeczalik/notify.tmp) -... -``` diff --git a/cmd/notify/main.go b/cmd/notify/main.go index 25cdad6..919744a 100644 --- a/cmd/notify/main.go +++ b/cmd/notify/main.go @@ -39,6 +39,26 @@ // directory. // // If no handler is specified notify prints each event to os.Stdout. +// +// Example usage +// +// Executing event handler from command line: +// +// ~ $ notify -c 'echo "Hello from handler! (event={{.Event}}, path={{.Path}})"' +// 2015/02/17 01:17:40 received notify.Create: "/Users/rjeczalik/notify.tmp" +// Hello from handler! (event=create, path=/Users/rjeczalik/notify.tmp) +// ... +// +// Executing event handler from file: +// +// ~ $ cat > handler < echo "Hello from handler! (event={{.Event}}, path={{.Path}})" +// > EOF +// +// ~ $ notify -f handler +// 2015/02/17 01:22:26 received notify.Create: "/Users/rjeczalik/notify.tmp" +// Hello from handler! (event=create, path=/Users/rjeczalik/notify.tmp) +// ... package main import (