cmd/notify: move examples to inline documentation

This commit is contained in:
Rafal Jeczalik
2015-02-17 01:38:33 +01:00
parent 3184323323
commit a7db06c87b
2 changed files with 20 additions and 19 deletions
-19
View File
@@ -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 <<EOF
> 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)
...
```
+20
View File
@@ -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 <<EOF
// > 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 (