2010-10-10 22:05:37 +00:00
|
|
|
{- git-annex backend list
|
|
|
|
- -}
|
|
|
|
|
|
|
|
module BackendList where
|
|
|
|
|
|
|
|
-- When adding a new backend, import it here and add it to the list.
|
2010-10-11 04:19:38 +00:00
|
|
|
import Types
|
2010-10-10 22:05:37 +00:00
|
|
|
import qualified BackendFile
|
|
|
|
import qualified BackendChecksum
|
|
|
|
import qualified BackendUrl
|
|
|
|
supportedBackends =
|
|
|
|
[ BackendFile.backend
|
|
|
|
, BackendChecksum.backend
|
|
|
|
, BackendUrl.backend
|
|
|
|
]
|
2010-10-11 04:19:38 +00:00
|
|
|
|
|
|
|
{- Parses a string with a list of backend names into
|
|
|
|
- a list of Backend objects. If the list is empty,
|
|
|
|
- defaults to supportedBackends. -}
|
|
|
|
parseBackendList :: String -> [Backend]
|
|
|
|
parseBackendList s =
|
|
|
|
if (length s == 0)
|
|
|
|
then supportedBackends
|
|
|
|
else map (lookupBackendName) $ words s
|
|
|
|
|
|
|
|
{- Looks up a supported backed by name. -}
|
|
|
|
lookupBackendName :: String -> Backend
|
|
|
|
lookupBackendName s =
|
|
|
|
if ((length matches) /= 1)
|
|
|
|
then error $ "unknown backend " ++ s
|
|
|
|
else matches !! 0
|
|
|
|
where matches = filter (\b -> s == name b) supportedBackends
|