finish message serialization of progress meters

Any given transfer can only display 1 progress meter at a time, or so
this code assumes. In some cases, there are progress meters for
different stages of a transfer, perhaps, and that is supported by this.

This commit was sponsored by Ethan Aubin.
This commit is contained in:
Joey Hess 2020-12-04 13:50:03 -04:00
parent 4efecaebd6
commit 31e417f351
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 91 additions and 33 deletions

View file

@ -96,18 +96,3 @@ flushed a = a >> hFlush stdout
outputSerialized :: (SerializedOutput -> IO ()) -> SerializedOutput -> IO ()
outputSerialized = id
emitSerializedOutput :: SerializedOutput -> Annex ()
emitSerializedOutput (OutputMessage msg) =
outputMessage' nojsonoutputter nojsonbuilder msg
where
nojsonoutputter _ _ = return False
nojsonbuilder = id
emitSerializedOutput (OutputError msg) = outputError msg
emitSerializedOutput (ProgressMeter sz old new) = undefined -- TODO
emitSerializedOutput (JSONObject b) =
withMessageState $ \s -> case outputType s of
JSONOutput _ -> liftIO $ flushed $ JSON.emit' b
SerializedOutput h -> liftIO $
outputSerialized h $ JSONObject b
_ -> q