cespare / reflex

Run a command when files change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider changing multiple regex/globs to represent OR, not AND

cespare opened this issue · comments

@mikejquinn asks why, for example, -g '*.txt' -g '*.go' uses a conjunction, rather than disjunction.

I can't remember why I did it this way. On the surface using OR seems obviously more useful. Think through the implications and consider switching.

I just bumped into the same issue - not sure why you'd want a conjuction instead of a disjunction, I was expecting the latter.

For anyone who comes across this, the simple workaround I used in the meantime, without making any changes to the reflex code, was just to use the -r '.(txt|go)' instead of the -g equivalent.

I should have started my comment with this: Thank you @cespare for making this package! A long time ago, I used to use the inotify facilities (inotifywatch and inotifywait) on linux for this, but those aren't available in OS X. There is an OS X work-alike using the BSD kqueue facilities - kqwait, but that only worked on the fruity machines... And fswatch which is cross-platform just feels too heavy. The same with the python-based watchdog/watchmedo. Reflex is refreshingly simple, yet sufficiently powerful. I am delighted by the lack of dependencies outside of golang standard library.

I'm also experiencing a similar issue. I want to use reflex but can not select multiple file kinds.

@azer selecting multiple file types is certainly possible, if not super convenient. Example:

reflex -r '(.c$)|(.h$)' echo {}

Thanks @cespare !