diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-30 19:10:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-30 19:10:54 -0400 |
commit | dba8fc8a1c55a091cb7992b6adfc6332eb2da585 (patch) | |
tree | 30e809088257fc3b9ca85730886d39e2d4ed10d1 /Remote.hs | |
parent | f6f7ee71310df1dd409819bef15ce020e290f4a8 (diff) |
export remoteList
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -16,6 +16,7 @@ module Remote ( hasKeyCheap, remoteTypes, + remoteList, remoteMap, byName, prettyPrintUUIDs, @@ -65,8 +66,8 @@ remoteTypes = {- Builds a list of all available Remotes. - Since doing so can be expensive, the list is cached. -} -genList :: Annex [Remote Annex] -genList = do +remoteList :: Annex [Remote Annex] +remoteList = do rs <- Annex.getState Annex.remotes if null rs then do @@ -86,7 +87,7 @@ genList = do {- Map of UUIDs of Remotes and their names. -} remoteMap :: Annex (M.Map UUID String) -remoteMap = M.fromList . map (\r -> (uuid r, name r)) <$> genList +remoteMap = M.fromList . map (\r -> (uuid r, name r)) <$> remoteList {- Looks up a remote by name. (Or by UUID.) Only finds currently configured - git remotes. -} @@ -99,8 +100,7 @@ byName n = do byName' :: String -> Annex (Either String (Remote Annex)) byName' "" = return $ Left "no remote specified" byName' n = do - allremotes <- genList - let match = filter matching allremotes + match <- filter matching <$> remoteList if null match then return $ Left $ "there is no git remote named \"" ++ n ++ "\"" else return $ Right $ Prelude.head match @@ -196,7 +196,7 @@ keyPossibilities' withtrusted key = do let validtrusteduuids = validuuids `intersect` trusted -- remotes that match uuids that have the key - allremotes <- filterM (repoNotIgnored . repo) =<< genList + allremotes <- filterM (repoNotIgnored . repo) =<< remoteList let validremotes = remotesWithUUID allremotes validuuids return (sort validremotes, validtrusteduuids) |