aboutsummaryrefslogtreecommitdiff
path: root/Types/TrustLevel.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-03 17:04:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-03 17:04:52 -0400
commita08863d8b8613b067766d0dca33c1f0c651d498d (patch)
treee7c9a5a6007428a5ecf1393a5df71f2a574c2c76 /Types/TrustLevel.hs
parent3bb9a92952f0da499315c897e3489fc02188618c (diff)
vicfg: New command, allows editing (or simply viewing) most of the repository configuration settings stored in the git-annex branch.
Incomplete; I need to finish parsing and saving. This will also be used for editing transfer control expresssions. Removed the group display from the status output, I didn't really like that format, and vicfg can be used to see as well as edit rempository group membership.
Diffstat (limited to 'Types/TrustLevel.hs')
-rw-r--r--Types/TrustLevel.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/Types/TrustLevel.hs b/Types/TrustLevel.hs
index 99d749730..83e4e5a5e 100644
--- a/Types/TrustLevel.hs
+++ b/Types/TrustLevel.hs
@@ -7,7 +7,9 @@
module Types.TrustLevel (
TrustLevel(..),
- TrustMap
+ TrustMap,
+ readTrustLevel,
+ showTrustLevel,
) where
import qualified Data.Map as M
@@ -15,6 +17,19 @@ import qualified Data.Map as M
import Types.UUID
data TrustLevel = Trusted | SemiTrusted | UnTrusted | DeadTrusted
- deriving Eq
+ deriving (Eq, Enum, Ord)
type TrustMap = M.Map UUID TrustLevel
+
+readTrustLevel :: String -> Maybe TrustLevel
+readTrustLevel "trusted" = Just Trusted
+readTrustLevel "untrusted" = Just UnTrusted
+readTrustLevel "semitrusted" = Just SemiTrusted
+readTrustLevel "dead" = Just DeadTrusted
+readTrustLevel _ = Nothing
+
+showTrustLevel :: TrustLevel -> String
+showTrustLevel Trusted = "trusted"
+showTrustLevel UnTrusted = "untrusted"
+showTrustLevel SemiTrusted = "semitrusted"
+showTrustLevel DeadTrusted = "dead"