hexyl
hexyl copied to clipboard
(Partial) compatibility with xxd?
I think it would be interesting to try and maintain some level of compatibility with xxd
. I recently came across this when following a blog post, trying to use hexyl
instead of xxd
.
- [x] The most obvious thing would be to introduce (yet another) alias for
--length
/--bytes
, i.e.-l
in addition to-n
and-c
. - [ ] Another cool feature of
xxd
is the-groupsize
option. This is already being discussed in #104. - [ ] What other flags/options could we try to support or try to provide aliases for?
What we're definitely not going to support is long single-dash options like -groupsize
. Instead, we are always going to keep a style where long options come with two dashes --groupsize
.
By the way, one thing that we already do better:
Even though xxd itself doesn't support hexadecimal notation […]
So instead of xxd -s $((0x2118)) ./hello
we can simply say hexyl -s 0x2118 ./hello
.
Note: we already try to be (partially) compatible with hexdump
.
Another xxd feature that I find is most lacking is -r (reverse hexdump). Using it you can convert a hexdump into a binary, like this:
xxd file > file.hex
cat file.hex | xxd -r > reconstructed-file
We now have a new --group-bytes
option in hexyl
which is basically the same as xxd
s -groupsize
(?). @RinHizakura why did we call it like that.. and not --groupsize
or at least --group-size
?
It is basically the same as -groupsize
in xxd
. Since I didn't aware of the requirement of compatibility, so the naming didn't align with xxd
at that time. I think you could change --group-bytes
to --groupsize
directly if you like it.
I see, thanks. I believe we should change it to --groupsize
then. At least as an alias. But I don't really see a reason to choose group-bytes over groupsize, if we can get xxd-compatibility this easy.
Fixed in 1df35eeb6312ff642922ca2185b53fd2f06d3ef7.
Another xxd feature that I find is most lacking is -r (reverse hexdump). Using it you can convert a hexdump into a binary, like this:
xxd file > file.hex cat file.hex | xxd -r > reconstructed-file
That is indeed pretty cool. This would be a major new feature and I don't currently plan on adding it to hexyl
. I think it's fair to close this for now.