diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-06-16 13:50:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-06-16 13:50:28 -0400 |
commit | ac374e91966be477a5833a8937c3a8cbeddc8669 (patch) | |
tree | 410c30e297bf6599b19a588cfe9f1b5c410c4789 /Messages | |
parent | ac354a3c8858b6a4cb21a5ab41676383730d7878 (diff) |
info: Added json output for "backend usage", "numcopies stats", "repositories containing these files", and "transfers in progress".
Diffstat (limited to 'Messages')
-rw-r--r-- | Messages/JSON.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Messages/JSON.hs b/Messages/JSON.hs index d0ed85a1f..be3dbbc58 100644 --- a/Messages/JSON.hs +++ b/Messages/JSON.hs @@ -10,7 +10,8 @@ module Messages.JSON ( end, note, add, - complete + complete, + DualDisp(..), ) where import Text.JSON @@ -35,3 +36,16 @@ add v = putStr $ Stream.add v complete :: JSON a => [(String, a)] -> IO () complete v = putStr $ Stream.start v ++ Stream.end + +-- A value that can be displayed either normally, or as JSON. +data DualDisp = DualDisp + { dispNormal :: String + , dispJson :: String + } + +instance JSON DualDisp where + showJSON = JSString . toJSString . dispJson + readJSON _ = Error "stub" + +instance Show DualDisp where + show = dispNormal |