Skip to content

Commit

Permalink
Rename ascii-only to 'default', as it is not only ASCII
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp authored and David Peter committed Dec 11, 2023
1 parent ba89e88 commit 711627b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum ByteCategory {
#[derive(Copy, Clone)]
#[non_exhaustive]
pub enum CharacterTable {
AsciiOnly,
Default,
CP437,
}

Expand Down Expand Up @@ -75,7 +75,7 @@ impl Byte {
fn as_char(self, character_table: CharacterTable) -> char {
use crate::ByteCategory::*;
match character_table {
CharacterTable::AsciiOnly => match self.category() {
CharacterTable::Default => match self.category() {
Null => '⋄',
AsciiPrintable => self.0 as char,
AsciiWhitespace if self.0 == 0x20 => ' ',
Expand Down Expand Up @@ -183,7 +183,7 @@ impl<'a, Writer: Write> PrinterBuilder<'a, Writer> {
group_size: 1,
base: Base::Hexadecimal,
endianness: Endianness::Big,
character_table: CharacterTable::AsciiOnly,
character_table: CharacterTable::Default,
}
}

Expand Down Expand Up @@ -744,7 +744,7 @@ mod tests {
1,
Base::Hexadecimal,
Endianness::Big,
CharacterTable::AsciiOnly,
CharacterTable::Default,
);

printer.print_all(input).unwrap();
Expand Down Expand Up @@ -800,7 +800,7 @@ mod tests {
1,
Base::Hexadecimal,
Endianness::Big,
CharacterTable::AsciiOnly,
CharacterTable::Default,
);
printer.display_offset(0xdeadbeef);

Expand Down Expand Up @@ -835,7 +835,7 @@ mod tests {
1,
Base::Hexadecimal,
Endianness::Big,
CharacterTable::AsciiOnly,
CharacterTable::Default,
);

printer.print_all(input).unwrap();
Expand Down Expand Up @@ -896,7 +896,7 @@ mod tests {
1,
Base::Hexadecimal,
Endianness::Big,
CharacterTable::AsciiOnly,
CharacterTable::Default,
);

printer.print_all(input).unwrap();
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ fn run() -> Result<()> {
Arg::new("character-table")
.long("character-table")
.value_name("FORMAT")
.value_parser(["codepage-437", "ascii-only"])
.default_value("ascii-only")
.value_parser(["default", "codepage-437"])
.default_value("default")
.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 use Code page 437 for those characters."
will use code page 437 for those characters."
),
)
.arg(
Expand Down Expand Up @@ -496,7 +496,7 @@ fn run() -> Result<()> {
.unwrap()
.as_ref()
{
"ascii-only" => CharacterTable::AsciiOnly,
"default" => CharacterTable::Default,
"codepage-437" => CharacterTable::CP437,
_ => unreachable!(),
};
Expand Down

0 comments on commit 711627b

Please sign in to comment.