diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-20 00:49:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-20 00:49:40 -0400 |
commit | 52533799535ebe1c133e2687ff1c5612d5bdb51d (patch) | |
tree | a30db8d442a4aa49d8cc45b5dc589b7a5a68b4dc /Limit.hs | |
parent | a1578e33dce4a9e7dcbd700077fc73237c35d19a (diff) |
convert Token to have separate constructors for each peice of syntax
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -48,17 +48,17 @@ add l = Annex.changeState $ \s -> s { Annex.limit = prepend $ Annex.limit s } prepend (Left ls) = Left $ l:ls prepend _ = error "internal" -{- Adds a new limit. -} -addlimit :: (FilePath -> Annex Bool) -> Annex () -addlimit = add . Utility.Matcher.Operation - {- Adds a new token. -} -token :: String -> Annex () -token = add . Utility.Matcher.Token +addToken :: String -> Annex () +addToken = add . Utility.Matcher.token + +{- Adds a new limit. -} +addLimit :: (FilePath -> Annex Bool) -> Annex () +addLimit = add . Utility.Matcher.Operation {- Add a limit to skip files that do not match the glob. -} addExclude :: String -> Annex () -addExclude glob = addlimit $ return . notExcluded +addExclude glob = addLimit $ return . notExcluded where notExcluded f = isNothing $ match cregex f [] cregex = compile regex [] @@ -69,7 +69,7 @@ addExclude glob = addlimit $ return . notExcluded addIn :: String -> Annex () addIn name = do u <- Remote.nameToUUID name - addlimit $ if name == "." then check local else check (remote u) + addLimit $ if name == "." then check local else check (remote u) where check a f = Backend.lookupFile f >>= handle a handle _ Nothing = return False @@ -85,7 +85,7 @@ addCopies :: String -> Annex () addCopies num = do case readMaybe num :: Maybe Int of Nothing -> error "bad number for --copies" - Just n -> addlimit $ check n + Just n -> addLimit $ check n where check n f = Backend.lookupFile f >>= handle n handle _ Nothing = return False |