summaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-07-26 19:15:34 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-07-26 19:15:34 -0400
commitbcc5ee4f322a139ee7cef2bae1fc9bea9f5398ca (patch)
treed4bfd67f6efcb0000c8749aaa6cdae964b333edc /Remote.hs
parente0b3fc906467ded314c75417d5b11b4b04375d1a (diff)
Removed dependency on json library; all JSON is now handled by aeson.
I've eyeballed all --json commands, and the only difference should be that some fields are re-ordered.
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/Remote.hs b/Remote.hs
index 081b02a9b..10c526e1e 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -55,10 +55,10 @@ module Remote (
claimingUrl,
) where
-import qualified Data.Map as M
-import Text.JSON
-import Text.JSON.Generic
import Data.Ord
+import Data.Aeson
+import qualified Data.Map as M
+import qualified Data.Text as T
import Annex.Common
import Types.Remote
@@ -194,7 +194,7 @@ prettyPrintUUIDsDescs header descm uuids =
{- An optional field can be included in the list of UUIDs. -}
prettyPrintUUIDsWith
- :: JSON v
+ :: ToJSON v
=> Maybe String
-> String
-> M.Map UUID RemoteName
@@ -203,7 +203,7 @@ prettyPrintUUIDsWith
-> Annex String
prettyPrintUUIDsWith optfield header descm showval uuidvals = do
hereu <- getUUID
- maybeShowJSON $ JSONObject [(header, map (jsonify hereu) uuidvals)]
+ maybeShowJSON $ JSONChunk [(header, map (jsonify hereu) uuidvals)]
return $ unwords $ map (\u -> "\t" ++ prettify hereu u ++ "\n") uuidvals
where
finddescription u = M.findWithDefault "" u descm
@@ -220,12 +220,12 @@ prettyPrintUUIDsWith optfield header descm showval uuidvals = do
addoptval s = case showval =<< optval of
Nothing -> s
Just val -> val ++ ": " ++ s
- jsonify hereu (u, optval) = toJSObject $ catMaybes
- [ Just ("uuid", toJSON $ fromUUID u)
- , Just ("description", toJSON $ finddescription u)
- , Just ("here", toJSON $ hereu == u)
+ jsonify hereu (u, optval) = object $ catMaybes
+ [ Just (T.pack "uuid", toJSON $ fromUUID u)
+ , Just (T.pack "description", toJSON $ finddescription u)
+ , Just (T.pack "here", toJSON $ hereu == u)
, case (optfield, optval) of
- (Just field, Just val) -> Just (field, showJSON val)
+ (Just field, Just val) -> Just (T.pack field, toJSON val)
_ -> Nothing
]