radovskyb/watcher ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Go library and command line tool that watches files and folders for changes without relying on OS file events, so it works the same on different platforms.
I want it to watch a single file or a whole directory, optionally recursively, and send updates through channels whenever something changes or an error happens. It should support things like choosing which kinds of changes to report, ignoring hidden files, ignoring specific paths, setting the polling speed, and limiting how many events come through at once. Please include a simple command that can watch the current folder, print the watched items, and optionally run another command whenever a change is detected. If possible, let the event details be piped into that command too.
Keep it simple and practical, with a clean example showing how to use it in Go and how to run it from the terminal. Look up current Go docs online if you need to.