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:
parent
8ccfbd14d0
commit
fa65f1d240
5 changed files with 35 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue