mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
fix(cli/fmt): make fmt output more readable (#7534)
This commit is contained in:
parent
d245ececb6
commit
e4188f7dfb
2 changed files with 13 additions and 7 deletions
|
@ -85,6 +85,12 @@ pub fn white_on_green(s: &str) -> impl fmt::Display {
|
||||||
style(&s, style_spec)
|
style(&s, style_spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn black_on_green(s: &str) -> impl fmt::Display {
|
||||||
|
let mut style_spec = ColorSpec::new();
|
||||||
|
style_spec.set_bg(Some(Green)).set_fg(Some(Black));
|
||||||
|
style(&s, style_spec)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn yellow(s: &str) -> impl fmt::Display {
|
pub fn yellow(s: &str) -> impl fmt::Display {
|
||||||
let mut style_spec = ColorSpec::new();
|
let mut style_spec = ColorSpec::new();
|
||||||
style_spec.set_fg(Some(Yellow));
|
style_spec.set_fg(Some(Yellow));
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn fmt_add_text(x: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_add_text_highlight(x: &str) -> String {
|
fn fmt_add_text_highlight(x: &str) -> String {
|
||||||
format!("{}", colors::white_on_green(x))
|
format!("{}", colors::black_on_green(x))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_rem() -> String {
|
fn fmt_rem() -> String {
|
||||||
|
@ -41,7 +41,7 @@ fn write_line_diff(
|
||||||
for (i, s) in split {
|
for (i, s) in split {
|
||||||
write!(
|
write!(
|
||||||
diff,
|
diff,
|
||||||
"{:0width$}{} ",
|
"{:width$}{} ",
|
||||||
*orig_line + i,
|
*orig_line + i,
|
||||||
colors::gray(" |"),
|
colors::gray(" |"),
|
||||||
width = line_number_width
|
width = line_number_width
|
||||||
|
@ -55,7 +55,7 @@ fn write_line_diff(
|
||||||
for (i, s) in split {
|
for (i, s) in split {
|
||||||
write!(
|
write!(
|
||||||
diff,
|
diff,
|
||||||
"{:0width$}{} ",
|
"{:width$}{} ",
|
||||||
*edit_line + i,
|
*edit_line + i,
|
||||||
colors::gray(" |"),
|
colors::gray(" |"),
|
||||||
width = line_number_width
|
width = line_number_width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue