mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Differentiate format on base
This commit is contained in:
1 parent
d5d645fc48
commit
85fa75ba67
1 file changed
+9
-2
+9
-2
@@ -299,11 +299,18 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
|||||||
Reset.render().to_string(),
|
Reset.render().to_string(),
|
||||||
],
|
],
|
||||||
border_style,
|
border_style,
|
||||||
byte_hex_panel: (0u8..=u8::MAX).map(|i| format!("{:02x}", i)).collect(),
|
byte_hex_panel: (0u8..=u8::MAX)
|
||||||
|
.map(|i| match base {
|
||||||
|
Base::Binary => format!("{i:08b}"),
|
||||||
|
Base::Octal => format!("{i:03o}"),
|
||||||
|
Base::Decimal => format!("{i:03}"),
|
||||||
|
Base::Hexadecimal => format!("{i:02x}"),
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
byte_char_panel: (0u8..=u8::MAX)
|
byte_char_panel: (0u8..=u8::MAX)
|
||||||
.map(|i| format!("{}", Byte(i).as_char()))
|
.map(|i| format!("{}", Byte(i).as_char()))
|
||||||
.collect(),
|
.collect(),
|
||||||
byte_hex_panel_g: (0u8..=u8::MAX).map(|i| format!("{:02x}", i)).collect(),
|
byte_hex_panel_g: (0u8..=u8::MAX).map(|i| format!("{i:02x}")).collect(),
|
||||||
byte_char_panel_g: (0u8..=u8::MAX)
|
byte_char_panel_g: (0u8..=u8::MAX)
|
||||||
.map(|i| format!("{}", Byte(i).as_char()))
|
.map(|i| format!("{}", Byte(i).as_char()))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
|||||||
Reference in new issue
Block a user