diff options
author | Joey Hess <joeyh@joeyh.name> | 2019-04-30 11:58:06 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2019-04-30 12:17:22 -0400 |
commit | 9dd764e6f719efb2950f35ee8eb2dd865190e39f (patch) | |
tree | eda6c9e51b3db7e56631f047c2263fa70f86d51f /Types/FileMatcher.hs | |
parent | 5d55f968ccfcac264b4f47af4ec339729204418a (diff) |
Added mimeencoding= term to annex.largefiles expressions.
* Added mimeencoding= term to annex.largefiles expressions.
This is probably mostly useful to match non-text files with eg
"mimeencoding=binary"
* git-annex matchexpression: Added --mimeencoding option.
Diffstat (limited to 'Types/FileMatcher.hs')
-rw-r--r-- | Types/FileMatcher.hs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Types/FileMatcher.hs b/Types/FileMatcher.hs index ccdf4796cf..d7ad96d066 100644 --- a/Types/FileMatcher.hs +++ b/Types/FileMatcher.hs @@ -1,6 +1,6 @@ {- git-annex file matcher types - - - Copyright 2013-2016 Joey Hess <id@joeyh.name> + - Copyright 2013-2019 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. -} @@ -9,6 +9,7 @@ module Types.FileMatcher where import Types.UUID (UUID) import Types.Key (Key, AssociatedFile) +import Types.Mime import Utility.Matcher (Matcher, Token) import Utility.FileSize @@ -16,12 +17,11 @@ import Control.Monad.IO.Class import qualified Data.Map as M import qualified Data.Set as S +-- Information about a file or a key that can be matched on. data MatchInfo = MatchingFile FileInfo | MatchingKey Key AssociatedFile - | MatchingInfo (OptInfo FilePath) (OptInfo Key) (OptInfo FileSize) (OptInfo MimeType) - -type MimeType = String + | MatchingInfo ProvidedInfo data FileInfo = FileInfo { currFile :: FilePath @@ -30,6 +30,16 @@ data FileInfo = FileInfo -- ^ filepath to match on; may be relative to top of repo or cwd } +-- This is used when testing a matcher, with values to match against +-- provided by the user, rather than queried from files. +data ProvidedInfo = ProvidedInfo + { providedFilePath :: OptInfo FilePath + , providedKey :: OptInfo Key + , providedFileSize :: OptInfo FileSize + , providedMimeType :: OptInfo MimeType + , providedMimeEncoding :: OptInfo MimeEncoding + } + type OptInfo a = Either (IO a) a -- If the OptInfo is not available, accessing it may result in eg an |