Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For review if helpful: Add --include and --includei options mirroring --exclude and --excludei #28

Merged
merged 1 commit into from Feb 1, 2020

Conversation

ghost
Copy link

@ghost ghost commented Oct 18, 2013

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 and inotifywait, 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. 👍

…_ignore_events_by_regex`, which allows the ignore logic in the RETURN(A) macro to be optionally negated.

In `inotifywatch` and `inotifywait`, add `--include` and `--includei` options, allowing regular expressions typically used with `--exclude` and `--excludei` to be easily negated.
@Seegras
Copy link

Seegras commented Nov 3, 2015

Yes, merge please. It often happens that you want to monitor a slew of directories for the appearance of one specifically named file (or named after a specific pattern, i.e. .log or core.), and you can't just exclude every other possible filename.

@ericcurtin ericcurtin merged commit 33c4bc4 into inotify-tools:next Feb 1, 2020
@ericcurtin
Copy link
Member

@ghost thanks so much for the contribution really appreciated. If you wouldn't mind could you look into adding unit tests, integration tests, man page documentation?

@Seegras actually, the helpful contributor seems to have deleted his account.

I would prefer master to be the development branch also. Eventually we will just have master and other branches for stable releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants