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

Add support for a "length" flag #61

Open
m-braha opened this issue Jan 26, 2025 · 1 comment
Open

Add support for a "length" flag #61

m-braha opened this issue Jan 26, 2025 · 1 comment
Labels
feature New feature or request under consideration This is still under consideration or discussion

Comments

@m-braha
Copy link

m-braha commented Jan 26, 2025

Hi! Often when I am looking at hex from binary files, I only want to see the first N bytes.

For example, with hexyl:

> hexyl -n 5 synth0.vgm
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 56 67 6d 20 8f          ┊                         │Vgm ×   ┊        │
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘

A --length/-n <N> flag would be awesome. I haven't looked at your code yet but I can try adding this support in a PR if you want.

Thanks for the cool tool!

@Arnau478
Copy link
Owner

I have mixed opinions on this. I like the "one program one thing" design from UNIX-like systems. For instance, on Linux, it's as simple as piping head with hevi.

$ hevi test_file
00000000 | 4865 6c6c 6f0a                          | Hello.           |
File size: 6 bytes
$ head test_file -c 2 | hevi -
00000000 | 4865                                    | He               |
File size: 2 bytes

I think this approach is a much neater one. That way, we can focus on hex dumps (doing one thing and doing it well).

That being said, I am aware it's not as simple on Windows. I hate the idea of sacrificing design decisions to suit an OS that's designed around bad principles, but honestly this doesn't "pollute" hevi much.

I'm afraid it could lead a series of additions I'm strongly against. That's the only reason I want to really think about this.

@Arnau478 Arnau478 added feature New feature or request under consideration This is still under consideration or discussion labels Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request under consideration This is still under consideration or discussion
Projects
None yet
Development

No branches or pull requests

2 participants