summaryrefslogtreecommitdiff
path: root/Command/Vicfg.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-10 20:40:30 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-10 20:40:30 -0400
commitfc9b378d13cbefba24337d77ec42d080215b8182 (patch)
tree2f8fc1a5e2da022458d8bddb8bf8201657be94e8 /Command/Vicfg.hs
parent41ef4b363d155294e77ef8054fb93e2075e89ae2 (diff)
converted ViCfg (trivially)
Diffstat (limited to 'Command/Vicfg.hs')
-rw-r--r--Command/Vicfg.hs34
1 files changed, 17 insertions, 17 deletions
diff --git a/Command/Vicfg.hs b/Command/Vicfg.hs
index 677ba5b13..cec032b80 100644
--- a/Command/Vicfg.hs
+++ b/Command/Vicfg.hs
@@ -175,7 +175,7 @@ genCfg cfg descs = unlines $ intercalate [""]
(\(s, g) -> gline g s)
(\g -> gline g "")
where
- gline g value = [ unwords ["groupwanted", g, "=", value] ]
+ gline g val = [ unwords ["groupwanted", g, "=", val] ]
allgroups = S.unions $ stdgroups : M.elems (cfgGroupMap cfg)
stdgroups = S.fromList $ map fromStandardGroup [minBound..maxBound]
@@ -198,9 +198,9 @@ genCfg cfg descs = unlines $ intercalate [""]
(\(l, u) -> line "schedule" u $ fromScheduledActivities l)
(\u -> line "schedule" u "")
- line setting u value =
+ line setting u val =
[ com $ "(for " ++ fromMaybe "" (M.lookup u descs) ++ ")"
- , unwords [setting, fromUUID u, "=", value]
+ , unwords [setting, fromUUID u, "=", val]
]
settings :: Ord v => Cfg -> M.Map UUID String -> (Cfg -> M.Map UUID v) -> [String] -> ((v, UUID) -> [String]) -> (UUID -> [String]) -> [String]
@@ -235,42 +235,42 @@ parseCfg defcfg = go [] defcfg . lines
| null l = Right cfg
| "#" `isPrefixOf` l = Right cfg
| null setting || null f = Left "missing field"
- | otherwise = parsed cfg f setting value'
+ | otherwise = parsed cfg f setting val'
where
(setting, rest) = separate isSpace l
- (r, value) = separate (== '=') rest
- value' = trimspace value
+ (r, val) = separate (== '=') rest
+ val' = trimspace val
f = reverse $ trimspace $ reverse $ trimspace r
trimspace = dropWhile isSpace
- parsed cfg f setting value
- | setting == "trust" = case readTrustLevel value of
- Nothing -> badval "trust value" value
+ parsed cfg f setting val
+ | setting == "trust" = case readTrustLevel val of
+ Nothing -> badval "trust value" val
Just t ->
let m = M.insert u t (cfgTrustMap cfg)
in Right $ cfg { cfgTrustMap = m }
| setting == "group" =
- let m = M.insert u (S.fromList $ words value) (cfgGroupMap cfg)
+ let m = M.insert u (S.fromList $ words val) (cfgGroupMap cfg)
in Right $ cfg { cfgGroupMap = m }
| setting == "wanted" =
- case checkPreferredContentExpression value of
+ case checkPreferredContentExpression val of
Just e -> Left e
Nothing ->
- let m = M.insert u value (cfgPreferredContentMap cfg)
+ let m = M.insert u val (cfgPreferredContentMap cfg)
in Right $ cfg { cfgPreferredContentMap = m }
| setting == "required" =
- case checkPreferredContentExpression value of
+ case checkPreferredContentExpression val of
Just e -> Left e
Nothing ->
- let m = M.insert u value (cfgRequiredContentMap cfg)
+ let m = M.insert u val (cfgRequiredContentMap cfg)
in Right $ cfg { cfgRequiredContentMap = m }
| setting == "groupwanted" =
- case checkPreferredContentExpression value of
+ case checkPreferredContentExpression val of
Just e -> Left e
Nothing ->
- let m = M.insert f value (cfgGroupPreferredContentMap cfg)
+ let m = M.insert f val (cfgGroupPreferredContentMap cfg)
in Right $ cfg { cfgGroupPreferredContentMap = m }
- | setting == "schedule" = case parseScheduledActivities value of
+ | setting == "schedule" = case parseScheduledActivities val of
Left e -> Left e
Right l ->
let m = M.insert u l (cfgScheduleMap cfg)