From 7053033f7708c2e432b3ad3e62356bd395932899 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 10 Oct 2012 16:04:28 -0400 Subject: add standard group selector to repo edit form --- Types/StandardGroups.hs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Types/StandardGroups.hs (limited to 'Types/StandardGroups.hs') diff --git a/Types/StandardGroups.hs b/Types/StandardGroups.hs new file mode 100644 index 000000000..151fc3304 --- /dev/null +++ b/Types/StandardGroups.hs @@ -0,0 +1,37 @@ +{- git-annex standard repository groups + - + - Copyright 2012 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Types.StandardGroups where + +data StandardGroup = ClientGroup | TransferGroup | ArchiveGroup | BackupGroup + deriving (Eq, Ord, Enum, Bounded, Show) + +fromStandardGroup :: StandardGroup -> String +fromStandardGroup ClientGroup = "client" +fromStandardGroup TransferGroup = "transfer" +fromStandardGroup ArchiveGroup = "archive" +fromStandardGroup BackupGroup = "backup" + +toStandardGroup :: String -> Maybe StandardGroup +toStandardGroup "client" = Just ClientGroup +toStandardGroup "transfer" = Just TransferGroup +toStandardGroup "archive" = Just ArchiveGroup +toStandardGroup "backup" = Just BackupGroup +toStandardGroup _ = Nothing + +descStandardGroup :: StandardGroup -> String +descStandardGroup ClientGroup = "client: a repository on your computer" +descStandardGroup TransferGroup = "transfer: distributes data to clients" +descStandardGroup ArchiveGroup = "archive: collect content that is not archived elsewhere" +descStandardGroup BackupGroup = "backup: collects all content" + +{- See doc/preferred_content.mdwn for explanations of these expressions. -} +preferredContent :: StandardGroup -> String +preferredContent ClientGroup = "exclude=*/archive/*" +preferredContent TransferGroup = "not inallgroup=client and " ++ preferredContent ClientGroup +preferredContent ArchiveGroup = "not copies=archive:1" +preferredContent BackupGroup = "" -- all content is preferred -- cgit v1.2.3