Skip to content
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

De-humanize sizes #6

Open
NobbZ opened this issue Sep 4, 2017 · 2 comments
Open

De-humanize sizes #6

NobbZ opened this issue Sep 4, 2017 · 2 comments
Assignees

Comments

@NobbZ
Copy link

NobbZ commented Sep 4, 2017

In general the feature set seems to be very usable, but to make it actually usable for me, I need to have exact bytesizes to get processed by another script.

So is there an option that actually always lists bytes?

@vmchale vmchale self-assigned this Sep 5, 2017
@nadesai
Copy link

nadesai commented Sep 9, 2018

Seconding this, it would really help my use case.

@nadesai
Copy link

nadesai commented Sep 10, 2018

I was able to do this in a very ugly fashion by changing impl fmt::Display for FileSize to display bytes instead of human-readable output in all cases. Unless I'm missing something, there's no way to check state while respecting the Display trait, so this wouldn't work in general.

However, the impl for Debug already displays raw bytes as desired, so displaying bytes conditionally should be as simple as

  • adding a flag -b or similar to display raw bytes rather than human-readable format
  • using format!("{:?}", size) (which invokes Debug instead of Display) in a bunch of places, conditioned on the presence of -b.

I'm trying to do this on my own fork, though the resulting code is not very elegant right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants