For review if helpful: Add --include and --includei options mirroring --exclude and --excludei #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds an additional
invert
argument to libinotifytools'inotifytools_ignore_events_by_regex
, which allows the ignore logic in the RETURN(A) macro to be optionally negated.Then, in
inotifywatch
andinotifywait
, this pull request adds--include
and--includei
options, allowing regular expressions typically used with--exclude
and--excludei
to be easily negated.I was looking for a way to easily watch for the close-after-write of exactly one regular file named 'system' in a particular directory, and couldn't find an easy way to to effectively express "exclude everything except for the string 'system'", since there was no way to invert matches and the POSIX regexec() doesn't support positive/negative lookahead assertions.
There was a thread with a similar issue here: http://stackoverflow.com/questions/7943528/inotifywait-exclude-regex-pattern-formatting
I have a patch that applies cleanly against master too, and can post it if it'd be at all helpful. I also haven't had a chance to add tests (just hacked this out last night in front of the TV), but would be willing to.
Copyright assigned to you; do what you will. 👍