mirror of
https://github.com/NixOS/nix
synced 2025-07-03 22:51:47 +02:00
Make large path warnings human-readable
This commit is contained in:
parent
5314430437
commit
cf3b044b7e
4 changed files with 8 additions and 7 deletions
|
@ -112,7 +112,7 @@ std::string rewriteStrings(std::string s, const StringMap & rewrites)
|
|||
}
|
||||
|
||||
|
||||
std::string renderSize(uint64_t value)
|
||||
std::string renderSize(uint64_t value, bool align)
|
||||
{
|
||||
static const std::array<char, 9> prefixes{{
|
||||
'K', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'
|
||||
|
@ -123,7 +123,7 @@ std::string renderSize(uint64_t value)
|
|||
++power;
|
||||
res /= 1024;
|
||||
}
|
||||
return fmt("%6.1f %ciB", power == 0 ? res / 1024 : res, prefixes.at(power));
|
||||
return fmt(align ? "%6.1f %ciB" : "%.1f %ciB", power == 0 ? res / 1024 : res, prefixes.at(power));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue