summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-27 10:55:02 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-27 10:55:02 -0400
commit00361f2bf9da7bb8244445eae2bcee5487c809d1 (patch)
tree5236ede82937a35ae4e2ff94cbc1aa0619c420f6 /Limit.hs
parentf684572aef9d12cf0881ce6cfc053a87579182a3 (diff)
Support --metadata field<number, --metadata field>number etc to match ranges of numeric values.
Similarly (well, for free), support preferred content expressions like metadata=field<number and metadata=field>number
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Limit.hs b/Limit.hs
index 174d4582d..dc38b172d 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -23,6 +23,7 @@ import Types.TrustLevel
import Types.Group
import Types.FileMatcher
import Types.MetaData
+import Annex.MetaData
import Logs.MetaData
import Logs.Group
import Logs.Unused
@@ -278,14 +279,12 @@ addMetaData :: String -> Annex ()
addMetaData = addLimit . limitMetaData
limitMetaData :: MkLimit Annex
-limitMetaData s = case parseMetaData s of
+limitMetaData s = case parseMetaDataMatcher s of
Left e -> Left e
- Right (f, v) ->
- let cglob = compileGlob (fromMetaValue v) CaseInsensative
- in Right $ const $ checkKey (check f cglob)
+ Right (f, matching) -> Right $ const $ checkKey (check f matching)
where
- check f cglob k = not . S.null
- . S.filter (matchGlob cglob . fromMetaValue)
+ check f matching k = not . S.null
+ . S.filter matching
. metaDataValues f <$> getCurrentMetaData k
addTimeLimit :: String -> Annex ()