Skip to content

Commit

Permalink
fix(cli): Add styling to --file-types
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 27, 2023
1 parent 686e4ce commit 1ca3216
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions crates/typos-cli/src/bin/typos-cli/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ impl Report for PrintBrief {
}
Message::Typo(msg) => print_brief_correction(msg)?,
Message::FileType(msg) => {
let info = INFO.render();
let reset = anstyle::Reset.render();
writeln!(
stdout().lock(),
"{}:{}",
"{info}{}{reset}: {}",
msg.path.display(),
msg.file_type.unwrap_or("-")
)?;
Expand Down Expand Up @@ -99,9 +101,11 @@ impl Report for PrintLong {
}
Message::Typo(msg) => print_long_correction(msg)?,
Message::FileType(msg) => {
let info = INFO.render();
let reset = anstyle::Reset.render();
writeln!(
stdout().lock(),
"{}:{}",
"{info}{}{reset}: {}",
msg.path.display(),
msg.file_type.unwrap_or("-")
)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-cli/tests/cmd/override-default-type.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ stdin = '''
Destory
'''
stdout = """
./key.asc:asc
./key.asc: asc
"""
stderr = ""

0 comments on commit 1ca3216

Please sign in to comment.