-
Notifications
You must be signed in to change notification settings - Fork 30
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
sort -h friendly output mode #15
base: master
Are you sure you want to change the base?
Conversation
6af6432
to
673c907
Compare
@hyunsik The Travis failure is due to: $ cargo fmt --all -- --write-mode=diff
Unrecognized option: 'write-mode' |
Hi @wookietreiber, I'm sorry for a late response. I missed your issue and this PR from a lot of email deluge. I'll fix the travis issue and review your PR by tomorrow. Thank you for your contribution! |
I've also fixed the build error at 9d8e13f. |
673c907
to
5823624
Compare
Thanks for catching the |
At the moment, I added a new function It could also be done completely compatible by creating a new stand-alone I don't know which way you'd prefer. Please advise. |
Hi, I'm sorry for a late response. The simple representation seems to lose a unit of measurement. I think that your approach is a good option. I also have another suggestion that implement functions to result in float values in different unit of measurements. For example,
Then, this approach will allows users to handle more various use-cases including your case. What do you think about that? |
I guess, I would prefer an even higher-level approach: enum OutputFormat {
SI, // 1000, e.g. "32 KB"
IEC, // 1024, e.g. "32 KiB"
Sort, // 1024, e.g. "32K"
}
fn to_string(b: ByteSize, fmt: OutputFormat) -> String {
// ...
} |
it's "a utility", not "an ...", because the pronunciation of "utility" starts with "ju"
5823624
to
6baa20e
Compare
@hyunsik I've finally gotten around to implementing my idea from my last comment. |
- this clarifies the intend beyond of what the previously used si boolean can - users may specify their own formatters - adds a byte formatter that is compatible with `sort -h` fixes bytesize-rs#14
6baa20e
to
123ccb3
Compare
As of now an extremely ugly variant to get in #14. Works, though. Please review.