fix --json-progress --json to be same as --json --json-progress

Fix behavior of --json-progress followed by --json, in which
the latter option disabled the former.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2018-02-19 14:03:23 -04:00
parent 8ccfbd14d0
commit fa65f1d240
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 35 additions and 12 deletions

View file

@ -55,12 +55,13 @@ metered othermeter key getsrcfile a = withMessageState $ \st ->
#else
nometer
#endif
go _ (MessageState { outputType = JSONOutput False }) = nometer
go msize (MessageState { outputType = JSONOutput True }) = do
buf <- withMessageState $ return . jsonBuffer
m <- liftIO $ rateLimitMeterUpdate 0.1 msize $
JSON.progress buf msize
a (combinemeter m)
go msize (MessageState { outputType = JSONOutput jsonoptions })
| jsonProgress jsonoptions = do
buf <- withMessageState $ return . jsonBuffer
m <- liftIO $ rateLimitMeterUpdate 0.1 msize $
JSON.progress buf msize
a (combinemeter m)
| otherwise = nometer
nometer = a $ combinemeter (const noop)
@ -96,7 +97,7 @@ meteredFile file combinemeterupdate key a =
needOutputMeter :: MessageState -> Bool
needOutputMeter s = case outputType s of
JSONOutput True -> True
JSONOutput jsonoptions -> jsonProgress jsonoptions
NormalOutput | concurrentOutputEnabled s -> True
_ -> False