ascii-progress 0.2.1.0 → 0.2.1.1
raw patch · 3 files changed
+7/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
ascii-progress.cabal view
@@ -1,5 +1,5 @@ name: ascii-progress-version: 0.2.1.0+version: 0.2.1.1 synopsis: A simple progress bar for the console. description: A simple Haskell progress bar for the console. Heavily borrows from TJ
bin/DownloadExample.hs view
@@ -17,12 +17,14 @@ res <- http req manager -- Get the Content-Length and initialize the progress bar let Just cl = lookup hContentLength (responseHeaders res)- pg <- liftIO $ newProgressBar def { pgTotal = read (ByteString.unpack cl) }+ pg <- liftIO $ newProgressBar def { pgTotal = read (ByteString.unpack cl)+ , pgWidth = 100+ , pgOnCompletion = putStrLn "Download done"+ } -- Consume the response updating the progress bar responseBody res $=+ updateProgress pg $$+- sinkNull -- Force the progress bar to complete liftIO $ complete pg- liftIO $ putStrLn "Done" updateProgress :: MonadIO m => ProgressBar -> ConduitM ByteString ByteString m () updateProgress pg = await >>= maybe (return ()) (\chunk -> do
lib/System/Console/AsciiProgress.hs view
@@ -52,7 +52,8 @@ hSetBuffering stdout NoBuffering info <- newProgressBarInfo opts cnlines <- modifyMVar nlines $ \nl -> return (nl + 1, nl)- putStrLn ""+ atProgressLine cnlines $+ getProgressStr opts <$> getInfoStats info >>= putStrLn future <- async $ start info cnlines return $ ProgressBar info future where