diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-22 13:53:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-22 14:00:17 -0400 |
commit | 6bffe509d7f1ec60168522585925a43dbfffbd36 (patch) | |
tree | a7fead7d1e5539139894f10c45f6d6c3d8d5cdc9 /Limit.hs | |
parent | 30cf6ce81ca8ff99f5284c5b991e546eb1da72ae (diff) |
Add --include, which is the same as --not --exclude.
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -55,10 +55,16 @@ addLimit :: (FilePath -> Annex Bool) -> Annex () addLimit = add . Utility.Matcher.Operation {- Add a limit to skip files that do not match the glob. -} +addInclude :: String -> Annex () +addInclude glob = addLimit $ return . matchglob glob + +{- Add a limit to skip files that match the glob. -} addExclude :: String -> Annex () -addExclude glob = addLimit $ return . notExcluded +addExclude glob = addLimit $ return . not . matchglob glob + +matchglob :: String -> FilePath -> Bool +matchglob glob f = isJust $ match cregex f [] where - notExcluded f = isNothing $ match cregex f [] cregex = compile regex [] regex = '^':wildToRegex glob |