From 1ca321659de8a7961f4eaf44e9666fd225c0dbf3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 27 Oct 2023 09:19:42 -0500 Subject: [PATCH] fix(cli): Add styling to --file-types --- crates/typos-cli/src/bin/typos-cli/report.rs | 8 ++++++-- crates/typos-cli/tests/cmd/override-default-type.toml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/typos-cli/src/bin/typos-cli/report.rs b/crates/typos-cli/src/bin/typos-cli/report.rs index 17fb206..cab227c 100644 --- a/crates/typos-cli/src/bin/typos-cli/report.rs +++ b/crates/typos-cli/src/bin/typos-cli/report.rs @@ -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("-") )?; @@ -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("-") )?; diff --git a/crates/typos-cli/tests/cmd/override-default-type.toml b/crates/typos-cli/tests/cmd/override-default-type.toml index 64d4293..5617138 100644 --- a/crates/typos-cli/tests/cmd/override-default-type.toml +++ b/crates/typos-cli/tests/cmd/override-default-type.toml @@ -6,6 +6,6 @@ stdin = ''' Destory ''' stdout = """ -./key.asc:asc +./key.asc: asc """ stderr = ""