cespare / reflex

Run a command when files change
MIT License
3.35k stars 135 forks source link

Watch multiple directories #97

Open SJrX opened 1 year ago

SJrX commented 1 year ago

Hi there,

So I have two go projects and the first depends on the second. When doing local development, I will use Go's module replace function to point to the other directory on disk. I have some reflex commands that will rebuild the projects. I was hoping that I could just have the first project watch for local go changes, or for the binary of the second one changes, however this doesn't seem to work.

In other words, if given two directories dir1 and dir2 I want to run reflex in each directory, but in dir1 watch file(s) in dir2 somehow.

My guess is that if you try to watch something outside of your current directory, either via a glob or a regex, it doesn't set up the watches properly and so never sees anything.

I think it might be nice for reflex to warn if a glob pattern doesn't match the current directory or something, but separately it'd also be nice to be able to do this. I ended up doing something super hacky where in the reflex command of the second, I update a file in a git ignored directory.

It's also possible that this does work and it is just user error.