Skip to content

Commit

Permalink
src, aggregate: fix colors for aggregate mode
Browse files Browse the repository at this point in the history
Use Cyan for folders in aggregate mode

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
  • Loading branch information
Mephistophiles committed Jul 27, 2020
1 parent 31c588e commit 4d2e839
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ pub fn aggregate(

fn path_color_of(path: impl AsRef<Path>) -> Option<Color> {
if path.as_ref().is_file() {
Some(Color::BrightBlack)
} else {
None
} else {
Some(Color::Cyan)
}
}

fn colorize_path(path: &Path, path_color: Option<colored::Color>) -> colored::ColoredString {
if let Some(path_color) = path_color {
path.display().to_string().as_str().color(path_color)
} else {
path.display().to_string().as_str().normal()
}
}

Expand All @@ -134,11 +142,7 @@ fn output_colored_path(
.to_string()
.as_str()
.green(),
path.as_ref()
.display()
.to_string()
.as_str()
.color(path_color.unwrap_or(Color::White)),
colorize_path(path.as_ref(), path_color),
if num_errors == 0 {
Cow::Borrowed("")
} else {
Expand Down

0 comments on commit 4d2e839

Please sign in to comment.