diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-15 14:16:48 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-15 14:16:48 -0400 |
commit | 38d5ad051eb93c5b939755587a720a6f6ca7ef4e (patch) | |
tree | ad7c23abee2d40b33ebd4c66d671dfba6a097b26 /Remote.hs | |
parent | 349117d6b4744ba7125841933fe9c2ea78515927 (diff) |
whereis --json: Urls are now listed inside the remote that claims them, rather than all together at the end.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -183,6 +183,7 @@ prettyPrintUUIDs header uuids = do prettyPrintUUIDsDescs :: String -> M.Map UUID RemoteName -> [UUID] -> Annex String prettyPrintUUIDsDescs header descm uuids = prettyPrintUUIDsWith Nothing header descm + (const Nothing) (zip uuids (repeat (Nothing :: Maybe String))) {- An optional field can be included in the list of UUIDs. -} @@ -191,9 +192,10 @@ prettyPrintUUIDsWith => Maybe String -> String -> M.Map UUID RemoteName + -> (v -> Maybe String) -> [(UUID, Maybe v)] -> Annex String -prettyPrintUUIDsWith optfield header descm uuidvals = do +prettyPrintUUIDsWith optfield header descm showval uuidvals = do hereu <- getUUID maybeShowJSON [(header, map (jsonify hereu) uuidvals)] return $ unwords $ map (\u -> "\t" ++ prettify hereu u ++ "\n") uuidvals @@ -209,9 +211,9 @@ prettyPrintUUIDsWith optfield header descm uuidvals = do | null n && ishere = "here" | ishere = addName n "here" | otherwise = n - addoptval s = case optval of + addoptval s = case showval =<< optval of Nothing -> s - Just val -> show val ++ ": " ++ s + Just val -> val ++ ": " ++ s jsonify hereu (u, optval) = toJSObject $ catMaybes [ Just ("uuid", toJSON $ fromUUID u) , Just ("description", toJSON $ finddescription u) |