summaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Remote.hs b/Remote.hs
index e211ef7cb..ac9da0536 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -24,6 +24,7 @@ module Remote (
uuidDescriptions,
byName,
prettyPrintUUIDs,
+ prettyListUUIDs,
remotesWithUUID,
remotesWithoutUUID,
keyLocations,
@@ -128,6 +129,20 @@ prettyPrintUUIDs desc uuids = do
, ("here", toJSON $ hereu == u)
]
+{- List of remote names and/or descriptions, for human display. -}
+prettyListUUIDs :: [UUID] -> Annex [String]
+prettyListUUIDs uuids = do
+ hereu <- getUUID
+ m <- uuidDescriptions
+ return $ map (\u -> prettify m hereu u) uuids
+ where
+ finddescription m u = M.findWithDefault "" u m
+ prettify m hereu u
+ | u == hereu = addName n "here"
+ | otherwise = n
+ where
+ n = finddescription m u
+
{- Filters a list of remotes to ones that have the listed uuids. -}
remotesWithUUID :: [Remote] -> [UUID] -> [Remote]
remotesWithUUID rs us = filter (\r -> uuid r `elem` us) rs