watchexec icon indicating copy to clipboard operation
watchexec copied to clipboard

[feature request] Option to disable recursive dir watch

Open gecon opened this issue 2 years ago • 3 comments

It would be handy to be able to avoid recursive watches on a directory. Practical as we want to watch only for changes on a directory, but not subdirectories with a lot of GB of files.

Thank you for your great work.

gecon avatar Nov 25 '21 08:11 gecon

Have you tried -i with glob pattern? #243

abitrolly avatar Jan 25 '22 10:01 abitrolly

This is not about post filtering, but pre filtering what is watched, in a sense.

passcod avatar Jan 25 '22 10:01 passcod

Yeah. This is needed if I have a dir with GBs of data files and some source files in project root that I want to pick up. For example

project/
    code_1
    code_2
    ... (imagine 100 more code files)
    data/
        GB upon GB of data files

Note how the only performant way to do this (which is still not really performant) is to watchexec with -w code_1 -w code_2 .... The solution is definitely to specify a non-recursive watch on project/ which will cause content in project/data/ to be excluded as intended.

In actual practice, this is perhaps a rare situation since any sane project layout would have the code under src/ or some such. But conceptually it's a rather big hole in the design of this CLI interface.

unphased avatar Mar 30 '23 08:03 unphased

Released in 2.1.0

passcod avatar Apr 28 '24 08:04 passcod