diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-02-19 14:03:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-02-19 14:12:15 -0400 |
commit | 0366c6eac698327ced9c63e241a9474a5c2a7e20 (patch) | |
tree | 6ca01bda2e500396154a4fa9b473fa3cc9bc193d /Messages/Progress.hs | |
parent | ef1a5a1f9b85de7261ac9a27bede3dedda88fb45 (diff) |
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.
Diffstat (limited to 'Messages/Progress.hs')
-rw-r--r-- | Messages/Progress.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Messages/Progress.hs b/Messages/Progress.hs index 61486d78d..cb924eeac 100644 --- a/Messages/Progress.hs +++ b/Messages/Progress.hs @@ -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 |