| 1 | /* |
| 2 | Copyright (c) 2012 Kyle Isom <[email protected]> |
| 3 | |
| 4 | Permission to use, copy, modify, and distribute this software for any |
| 5 | purpose with or without fee is hereby granted, provided that the |
| 6 | above copyright notice and this permission notice appear in all |
| 7 | copies. |
| 8 | |
| 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA |
| 14 | OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | Package fswatch provides simple UNIX file system watching in Go. It is based around |
| 21 | the Watcher struct, which should be initialised with either NewWatcher or |
| 22 | NewAutoWatcher. Both functions accept a variable number of string arguments |
| 23 | specfying the paths to be loaded, which may be globbed, and return a pointer |
| 24 | to a Watcher. This value can be started and stopped with the Start() and |
| 25 | Stop() methods. The Watcher will automatically stop if all the files it is |
| 26 | watching have been deleted. |
| 27 | |
| 28 | The Start() method returns a read-only channel that receives Notification |
| 29 | values. The Stop() method closes the channel, and no files will be watched |
| 30 | from that point. |
| 31 | |
| 32 | The list of files being watched may be retrieved with the Watch() method and |
| 33 | the current state of the files being watched may be retrieved with the |
| 34 | State() method. See the go docs for more information. |
| 35 | |
| 36 | In synchronous mode (i.e. Watchers obtained from NewWatcher()), deleted files |
| 37 | will not be removed from the watch list, allowing the user to watch for files |
| 38 | that might be created at a future time, or to allow notification of files that |
| 39 | are deleted and then recreated. The auto-watching mode (i.e. from |
| 40 | NewAutoWatcher()) will remove deleted files from the watch list, as it |
| 41 | automatically adds new files to the watch list. |
| 42 | |
| 43 | If "." is not specified explicitly in the list of files to watch, new |
| 44 | directories created in the current directory will not be seen (as per the |
| 45 | behaviour of filepath.Match); any directories being watched will, however. |
| 46 | If you wish to watch for changes in the current directory, be sure to specify |
| 47 | ".". |
| 48 | */ |
| 49 | package fswatch |