mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Update ProgressReporter to display file size in KB
This commit is contained in:
parent
865eff1956
commit
49c28409e0
1 changed files with 13 additions and 5 deletions
|
@ -438,11 +438,19 @@ impl<R: Read> Read for ProgressReporter<R> {
|
|||
self.read += size;
|
||||
|
||||
if let Some(total) = self.total {
|
||||
eprint!(
|
||||
"\u{001b}[2K\u{001b}[G[{:.1} / {:.1} MB]",
|
||||
self.read as f32 / 1_000_000.0,
|
||||
total as f32 / 1_000_000.0,
|
||||
);
|
||||
let total = total as f32 / 1_000_000.0;
|
||||
let read = self.read as f32 / 1_000_000.0;
|
||||
|
||||
if total < 1.0 {
|
||||
eprint!(
|
||||
"\u{001b}[2K\u{001b}[G[{:.1} / {:.1} KB]",
|
||||
// Convert MB to KB
|
||||
read * 1000.0,
|
||||
total * 1000.0,
|
||||
);
|
||||
} else {
|
||||
eprint!("\u{001b}[2K\u{001b}[G[{:.1} / {:.1} MB]", read, total,);
|
||||
}
|
||||
} else {
|
||||
eprint!(
|
||||
"\u{001b}[2K\u{001b}[G[{:.1} MB]",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue