syntax tweaks
Although I hate to lose one of the only places I've ever used the list monad..
This commit is contained in:
parent
441b138592
commit
32de288c35
1 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ configSet u c = do
|
||||||
|
|
||||||
{- Map of remotes by uuid containing key/value config maps. -}
|
{- Map of remotes by uuid containing key/value config maps. -}
|
||||||
readRemoteLog :: Annex (M.Map UUID RemoteConfig)
|
readRemoteLog :: Annex (M.Map UUID RemoteConfig)
|
||||||
readRemoteLog = (simpleMap . parseLog parseConfig) <$> Annex.Branch.get remoteLog
|
readRemoteLog = simpleMap . parseLog parseConfig <$> Annex.Branch.get remoteLog
|
||||||
|
|
||||||
parseConfig :: String -> Maybe RemoteConfig
|
parseConfig :: String -> Maybe RemoteConfig
|
||||||
parseConfig = Just . keyValToConfig . words
|
parseConfig = Just . keyValToConfig . words
|
||||||
|
@ -59,7 +59,7 @@ configToKeyVal m = map toword $ sort $ M.toList m
|
||||||
toword (k, v) = k ++ "=" ++ configEscape v
|
toword (k, v) = k ++ "=" ++ configEscape v
|
||||||
|
|
||||||
configEscape :: String -> String
|
configEscape :: String -> String
|
||||||
configEscape = (>>= escape)
|
configEscape = concatMap escape
|
||||||
where
|
where
|
||||||
escape c
|
escape c
|
||||||
| isSpace c || c `elem` "&" = "&" ++ show (ord c) ++ ";"
|
| isSpace c || c `elem` "&" = "&" ++ show (ord c) ++ ";"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue