fswatch icon indicating copy to clipboard operation
fswatch copied to clipboard

Request: change --include to only print matching paths

Open brettdh opened this issue 8 years ago • 2 comments

From #82:

We may even open another issue and discuss whether this is a sane default (I'm not sure either).

I'm going to toss my vote in for 'no' on that question.

Like the submitter of that issue, I found myself thinking --include was broken, because paths not matching my filter were getting printed. I'm not sure where this precedent comes from, but my expectation of a filter option named --include is that it includes ONLY those paths that match the filter. Perhaps this thinking comes from using tcpdump a lot.

brettdh avatar Oct 28 '15 15:10 brettdh

Warning: speculation follows. I haven't really thought this through. :-)

The "first filter wins" approach you mentioned in #82 seems sensible, with a catch-all of "print" if there are no filters or only exclude filters, and a catch-all of "don't print" if there is at least one include filter.

brettdh avatar Oct 28 '15 15:10 brettdh

I had to find this issue in order to work out what was going on, so I'd at least say the man page needs updating to explain how the include/exclude flags work.

However, I'd definitely be in favour of also changing the default so that when no filters are specified all files are watched, but running with only an include would watch only those files. Exclude could then be used to narrow that list down.

Drarok avatar Jun 20 '19 09:06 Drarok