summaryrefslogtreecommitdiff
path: root/Annex/MetaData/StandardFields.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/MetaData/StandardFields.hs')
-rw-r--r--Annex/MetaData/StandardFields.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/Annex/MetaData/StandardFields.hs b/Annex/MetaData/StandardFields.hs
new file mode 100644
index 000000000..00b810593
--- /dev/null
+++ b/Annex/MetaData/StandardFields.hs
@@ -0,0 +1,38 @@
+{- git-annex metadata, standard fields
+ -
+ - Copyright 2014 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Annex.MetaData.StandardFields (
+ tagMetaField,
+ yearMetaField,
+ monthMetaField,
+ lastChangedField,
+ isLastChangedField
+) where
+
+import Types.MetaData
+
+import Data.List
+
+tagMetaField :: MetaField
+tagMetaField = mkMetaFieldUnchecked "tag"
+
+yearMetaField :: MetaField
+yearMetaField = mkMetaFieldUnchecked "year"
+
+monthMetaField :: MetaField
+monthMetaField = mkMetaFieldUnchecked "month"
+
+lastChangedField :: MetaField -> MetaField
+lastChangedField f = mkMetaFieldUnchecked (fromMetaField f ++ lastchanged)
+
+isLastChangedField :: MetaField -> Bool
+isLastChangedField f = lastchanged `isSuffixOf` s && s /= lastchanged
+ where
+ s = fromMetaField f
+
+lastchanged :: String
+lastchanged = "-lastchanged"