mirror of
https://github.com/dgelessus/python-rsrcfork.git
synced 2025-02-16 18:30:24 +00:00
Change hex dump output format to match hexdump -C
This commit is contained in:
parent
b2fa5f8b0f
commit
194c886472
@ -130,7 +130,7 @@ Changelog
|
||||
Version 1.2.1 (next version)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* Changed ``--format=dump`` output to collapse multiple subsequent identical lines into a single ``*``.
|
||||
* Changed ``--format=dump`` output to match ``hexdump -C``'s format - spacing has been adjusted, and multiple subsequent identical lines are collapsed into a single ``*``.
|
||||
|
||||
Version 1.2.0
|
||||
^^^^^^^^^^^^^
|
||||
|
@ -166,9 +166,10 @@ def _hexdump(data: bytes):
|
||||
print("*")
|
||||
asterisk_shown = True
|
||||
else:
|
||||
line_hex = " ".join(f"{byte:02x}" for byte in line)
|
||||
line_hex_left = " ".join(f"{byte:02x}" for byte in line[:8])
|
||||
line_hex_right = " ".join(f"{byte:02x}" for byte in line[8:])
|
||||
line_char = line.decode(_TEXT_ENCODING).translate(_TRANSLATE_NONPRINTABLES)
|
||||
print(f"{i:08x} {line_hex:<{16*2+15}} |{line_char}|")
|
||||
print(f"{i:08x} {line_hex_left:<{8*2+7}} {line_hex_right:<{8*2+7}} |{line_char}|")
|
||||
asterisk_shown = False
|
||||
last_line = line
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user