make find show files meeting limits, even when not present

find: Rather than only showing files whose contents are present, when used
with --exclude --copies or --in, displays all files that match the
specified conditions.

Note that this is a behavior change for find --exclude! Old behavior
can be gotten with find --in . --exclude=...
This commit is contained in:
Joey Hess 2011-09-18 20:41:51 -04:00
parent 9da23dff78
commit 33cd1ffbfe
5 changed files with 29 additions and 5 deletions

View file

@ -20,7 +20,8 @@ module Utility.Matcher (
Matcher,
generate,
match,
matchM
matchM,
matchesAny
) where
import Control.Monad
@ -81,3 +82,10 @@ matchM m v = go m
go (Or m1 m2) = liftM2 (||) (go m1) (go m2)
go (Not m1) = liftM not (go m1)
go (Op o) = o v
{- Checks is a matcher contains no limits, and so (presumably) matches
- anything. Note that this only checks the trivial case; it is possible
- to construct matchers that match anything but are more complicated. -}
matchesAny :: Matcher a -> Bool
matchesAny Any = True
matchesAny _ = False