Include amount of data transferred in progress display.

This commit is contained in:
Joey Hess 2018-03-14 13:39:14 -04:00
parent d8702c5259
commit ba44ca80e6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 9 deletions

View file

@ -36,6 +36,7 @@ git-annex (6.20180228) UNRELEASED; urgency=medium
* Note that Remote/Git.hs now contains AGPL licensed code,
thus the license of git-annex as a whole is AGPL. This was already
the case when git-annex was built with the webapp enabled.
* Include amount of data transferred in progress display.
-- Joey Hess <id@joeyh.name> Wed, 28 Feb 2018 11:53:03 -0400

View file

@ -355,23 +355,26 @@ clearMeterHandle (Meter _ _ v _) h = do
hFlush h
-- | Display meter in the form:
-- 10% 300 KiB/s 16m40s
-- 10% 1.3MiB 300 KiB/s 16m40s
-- or when total size is not known:
-- 1.3 MiB 300 KiB/s
-- 1.3 MiB 300 KiB/s
bandwidthMeter :: RenderMeter
bandwidthMeter mtotalsize (BytesProcessed old, before) (BytesProcessed new, now) =
unwords $ catMaybes
[ Just percentoramount
-- Pad enough for max width: "xxxx.xx KiB xxxx KiB/s"
, Just $ replicate (23 - length percentoramount - length rate) ' '
[ Just percentamount
-- Pad enough for max width: "100% xxxx.xx KiB xxxx KiB/s"
, Just $ replicate (29 - length percentamount - length rate) ' '
, Just rate
, estimatedcompletion
]
where
percentoramount = case mtotalsize of
Just totalsize -> showPercentage 0 $
percentage totalsize (min new totalsize)
Nothing -> roughSize' memoryUnits True 2 new
amount = roughSize' memoryUnits True 2 new
percentamount = case mtotalsize of
Just totalsize ->
let p = showPercentage 0 $
percentage totalsize (min new totalsize)
in p ++ replicate (6 - length p) ' ' ++ amount
Nothing -> amount
rate = roughSize' memoryUnits True 0 bytespersecond ++ "/s"
bytespersecond
| duration == 0 = fromIntegral transferred