Rename ascii-only to 'default', as it is not only ASCII

This commit is contained in:
David Peter authored and David Peter committed 2023-12-11 23:00:49 +01:00
1 parent ba89e88dfd
commit 711627bfe8
2 files changed
+12 -12

No files matched your search

+7 -7
View File
@@ -25,7 +25,7 @@ pub enum ByteCategory {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[non_exhaustive] #[non_exhaustive]
pub enum CharacterTable { pub enum CharacterTable {
AsciiOnly, Default,
CP437, CP437,
} }
@@ -75,7 +75,7 @@ impl Byte {
fn as_char(self, character_table: CharacterTable) -> char { fn as_char(self, character_table: CharacterTable) -> char {
use crate::ByteCategory::*; use crate::ByteCategory::*;
match character_table { match character_table {
CharacterTable::AsciiOnly => match self.category() { CharacterTable::Default => match self.category() {
Null => '⋄', Null => '⋄',
AsciiPrintable => self.0 as char, AsciiPrintable => self.0 as char,
AsciiWhitespace if self.0 == 0x20 => ' ', AsciiWhitespace if self.0 == 0x20 => ' ',
@@ -183,7 +183,7 @@ impl<'a, Writer: Write> PrinterBuilder<'a, Writer> {
group_size: 1, group_size: 1,
base: Base::Hexadecimal, base: Base::Hexadecimal,
endianness: Endianness::Big, endianness: Endianness::Big,
character_table: CharacterTable::AsciiOnly, character_table: CharacterTable::Default,
} }
} }
@@ -744,7 +744,7 @@ mod tests {
1, 1,
Base::Hexadecimal, Base::Hexadecimal,
Endianness::Big, Endianness::Big,
CharacterTable::AsciiOnly, CharacterTable::Default,
); );
printer.print_all(input).unwrap(); printer.print_all(input).unwrap();
@@ -800,7 +800,7 @@ mod tests {
1, 1,
Base::Hexadecimal, Base::Hexadecimal,
Endianness::Big, Endianness::Big,
CharacterTable::AsciiOnly, CharacterTable::Default,
); );
printer.display_offset(0xdeadbeef); printer.display_offset(0xdeadbeef);
@@ -835,7 +835,7 @@ mod tests {
1, 1,
Base::Hexadecimal, Base::Hexadecimal,
Endianness::Big, Endianness::Big,
CharacterTable::AsciiOnly, CharacterTable::Default,
); );
printer.print_all(input).unwrap(); printer.print_all(input).unwrap();
@@ -896,7 +896,7 @@ mod tests {
1, 1,
Base::Hexadecimal, Base::Hexadecimal,
Endianness::Big, Endianness::Big,
CharacterTable::AsciiOnly, CharacterTable::Default,
); );
printer.print_all(input).unwrap(); printer.print_all(input).unwrap();
+5 -5
View File
@@ -217,12 +217,12 @@ fn run() -> Result<()> {
Arg::new("character-table") Arg::new("character-table")
.long("character-table") .long("character-table")
.value_name("FORMAT") .value_name("FORMAT")
.value_parser(["codepage-437", "ascii-only"]) .value_parser(["default", "codepage-437"])
.default_value("ascii-only") .default_value("default")
.help( .help(
"The character table that should be used. 'ascii-only' \ "The character table that should be used. 'default' \
will show dots for non-ASCII characters, 'codepage-437' \ will show dots for non-ASCII characters, 'codepage-437' \
will use Code page 437 for those characters." will use code page 437 for those characters."
), ),
) )
.arg( .arg(
@@ -496,7 +496,7 @@ fn run() -> Result<()> {
.unwrap() .unwrap()
.as_ref() .as_ref()
{ {
"ascii-only" => CharacterTable::AsciiOnly, "default" => CharacterTable::Default,
"codepage-437" => CharacterTable::CP437, "codepage-437" => CharacterTable::CP437,
_ => unreachable!(), _ => unreachable!(),
}; };