sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
8.92k stars 227 forks source link

Allow hex numbers and data units for block size argument #144

Closed merkrafter closed 2 years ago

merkrafter commented 2 years ago

Summary

Closes #111 This PR allows arguments like 4kb or 0x10 for --block-size. The 'block' unit is not allowed in this context (see discussion on related issue).

sharkdp commented 2 years ago

Thank you very much for your contribution!

This looks great on a first glance. Happy to review it in detail after the cleanup.

I used the const_format crate to display the default block size to the user in a convenient and consistent way. However, using it required Rust 1.46.0+. Do you think this detail is worth raising the minimum required Rust version?

I didn't know this crate. That sounds really helpful. Bumping to Rust 1.46 sounds good. Since this only affects hexyl as a tool and not hexyl as a library, I'd be okay to bump it even further, in case that helps with other parts of the code. I don't think we have a lot of "customers" anyway: https://crates.io/crates/hexyl/reverse_dependencies

merkrafter commented 2 years ago

Please let me know if you have other concerns/ideas/suggestions etc. :))