tin-summer icon indicating copy to clipboard operation
tin-summer copied to clipboard

De-humanize sizes

Open NobbZ opened this issue 6 years ago • 2 comments

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?

NobbZ avatar Sep 04 '17 09:09 NobbZ

Seconding this, it would really help my use case.

nadesai avatar Sep 09 '18 19:09 nadesai

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.

nadesai avatar Sep 10 '18 21:09 nadesai