NewWatcher creates a new Watcher for the given PRD file path.
(path string)
| 26 | |
| 27 | // NewWatcher creates a new Watcher for the given PRD file path. |
| 28 | func NewWatcher(path string) (*Watcher, error) { |
| 29 | fsWatcher, err := fsnotify.NewWatcher() |
| 30 | if err != nil { |
| 31 | return nil, err |
| 32 | } |
| 33 | |
| 34 | w := &Watcher{ |
| 35 | path: path, |
| 36 | watcher: fsWatcher, |
| 37 | events: make(chan WatcherEvent, 10), |
| 38 | done: make(chan struct{}), |
| 39 | } |
| 40 | |
| 41 | return w, nil |
| 42 | } |
| 43 | |
| 44 | // Start begins watching the PRD file for changes. |
| 45 | func (w *Watcher) Start() error { |
no outgoing calls