1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

Move printSize() into libutil

Also always include the unit (i.e. "MiB" instead of "M").
This commit is contained in:
Eelco Dolstra 2024-05-10 16:49:40 +02:00
parent dbe1b51580
commit 5314430437
4 changed files with 26 additions and 16 deletions

View file

@ -137,6 +137,12 @@ N string2IntWithUnitPrefix(std::string_view s)
throw UsageError("'%s' is not an integer", s);
}
/**
* Pretty-print a byte value, e.g. 12433615056 is rendered as `11.6
* GiB`.
*/
std::string renderSize(uint64_t value);
/**
* Parse a string into a float.
*/