New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add human readable closure sizes to nix path-info #2373
Add human readable closure sizes to nix path-info #2373
Conversation
cc3654a
to
09f9cec
Compare
Default behavior unchanged, both to maintain compatibility and to be consistent with default unix utility behavior:
And with the new option (human sorted to boot!):
|
Unfortunately, -h is already taken as a short option by --help, so we have to use a different letter or the capitalized version. Resolves NixOS#2363
09f9cec
to
2669fee
Compare
Is there an easy way to get the |
src/nix/path-info.cc
Outdated
++power; | ||
res /= 1024; | ||
} | ||
std::cout << '\t' << std::setw(11) << std::setprecision(3) << res << idents[power]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use iostream manipulators, they're stateful and ugly. Boost format strings are much nicer (e.g. std::cout << fmt("%.3f", ...)
or something like that.
idents[power]
looks like it could overflow in theory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, updated to be future proof in a > 1024 yottabyte world, and swapped to boost::format 👍
If the user has an object greater than 1024 yottabytes, it'll just display it as N yottabytes instead of overflowing. Swaps to use boost::format strings instead of std::setw and std::setprecision.
Closer inspection of
The |
If there are any further suggestions I'm happy to update; otherwise I think this should be good to go as-is. |
Thanks, merged! |
If we wanted to be "overly" correct, we would show EDIT: thanks for the PR, BTW. |
Unfortunately, -h is already taken as a short option by --help, so we have to
use a different letter or the capitalized version.
Resolves #2363