Add --include, which is the same as --not --exclude.
This commit is contained in:
parent
30cf6ce81c
commit
6bffe509d7
6 changed files with 28 additions and 10 deletions
10
Limit.hs
10
Limit.hs
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue