summaryrefslogtreecommitdiff
path: root/Utility/Matcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:41:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:42:15 -0400
commit33cd1ffbfe200188a4fc61fd5715e7aa29556d7f (patch)
treeb21be384c89e29e2b56e5e1c5e1a931871837c27 /Utility/Matcher.hs
parent9da23dff78d80158ba01a271ac2a32830fd9bccc (diff)
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=...
Diffstat (limited to 'Utility/Matcher.hs')
-rw-r--r--Utility/Matcher.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Utility/Matcher.hs b/Utility/Matcher.hs
index 08534fc30..5cf000b1b 100644
--- a/Utility/Matcher.hs
+++ b/Utility/Matcher.hs
@@ -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