improve matcher data type to allow matching Keys, instead of just files (no behavior changes)

This commit is contained in:
Joey Hess 2014-01-18 14:51:55 -04:00
parent a135bbd5a2
commit 8ce515ffe4
8 changed files with 49 additions and 39 deletions

View file

@ -13,9 +13,11 @@ import Limit
import Types.FileMatcher
addWantGet :: Annex ()
addWantGet = addLimit $ Right $ const $
\fileinfo -> wantGet False (Just $ matchFile fileinfo)
addWantGet = addLimit $ Right $ const $ checkWant $ wantGet False
addWantDrop :: Annex ()
addWantDrop = addLimit $ Right $ const $
\fileinfo -> wantDrop False Nothing (Just $ matchFile fileinfo)
addWantDrop = addLimit $ Right $ const $ checkWant $ wantDrop False Nothing
checkWant :: (Maybe FilePath -> Annex Bool) -> MatchInfo -> Annex Bool
checkWant a (MatchingFile fi) = a (Just $ matchFile fi)
checkWant _ (MatchingKey _) = return False