mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
progress-bar: hide expected if expected is 0 (unknown)
Sometimes, "expected" can be "0", but in fact means "unknown". This is for example the case when downloading a file while the http server doesn't send the `Content-Length` header, like when running `nix build` pointing to a nixpkgs checkout streamed from GitHub: ⇒ nix build -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz hello [1.8/0.0 MiB DL] downloading 'https://github.com/NixOS/nixpkgs/archive/master.tar.gz' In that case, don't show that weird progress bar, but only the (slowly increasing) downloaded size ("done"). ⇒ nix build -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz hello [1.8 MiB DL] downloading 'https://github.com/NixOS/nixpkgs/archive/master.tar.gz' This commit also updates fmt calls with three numbers (when something is currently 'running' too) - I'm not sure if this can be provoked, but showing "0" as expected doesn't make any sense, as we're obviously doing more than nothing.
This commit is contained in:
parent
f9a2ea4486
commit
6ade7ec022
1 changed files with 11 additions and 4 deletions
|
@ -333,11 +333,18 @@ public:
|
||||||
|
|
||||||
if (running || done || expected || failed) {
|
if (running || done || expected || failed) {
|
||||||
if (running)
|
if (running)
|
||||||
s = fmt(ANSI_BLUE + numberFmt + ANSI_NORMAL "/" ANSI_GREEN + numberFmt + ANSI_NORMAL "/" + numberFmt,
|
if (expected != 0)
|
||||||
running / unit, done / unit, expected / unit);
|
s = fmt(ANSI_BLUE + numberFmt + ANSI_NORMAL "/" ANSI_GREEN + numberFmt + ANSI_NORMAL "/" + numberFmt,
|
||||||
|
running / unit, done / unit, expected / unit);
|
||||||
|
else
|
||||||
|
s = fmt(ANSI_BLUE + numberFmt + ANSI_NORMAL "/" ANSI_GREEN + numberFmt + ANSI_NORMAL,
|
||||||
|
running / unit, done / unit);
|
||||||
else if (expected != done)
|
else if (expected != done)
|
||||||
s = fmt(ANSI_GREEN + numberFmt + ANSI_NORMAL "/" + numberFmt,
|
if (expected != 0)
|
||||||
done / unit, expected / unit);
|
s = fmt(ANSI_GREEN + numberFmt + ANSI_NORMAL "/" + numberFmt,
|
||||||
|
done / unit, expected / unit);
|
||||||
|
else
|
||||||
|
s = fmt(ANSI_GREEN + numberFmt + ANSI_NORMAL, done / unit);
|
||||||
else
|
else
|
||||||
s = fmt(done ? ANSI_GREEN + numberFmt + ANSI_NORMAL : numberFmt, done / unit);
|
s = fmt(done ? ANSI_GREEN + numberFmt + ANSI_NORMAL : numberFmt, done / unit);
|
||||||
s = fmt(itemFmt, s);
|
s = fmt(itemFmt, s);
|
||||||
|
|
Loading…
Reference in a new issue