info: Added json output for "backend usage", "numcopies stats", "repositories containing these files", and "transfers in progress".
This commit is contained in:
parent
c96b333869
commit
67f7f1b1cb
5 changed files with 94 additions and 44 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue