Skip to content

Commit

Permalink
Little bit of code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Jul 11, 2020
1 parent 9d58989 commit 03bc451
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Fixed
- Fix local `stderr` formatting for `log`.
- Fix missing sleep in local `follow` loop, resulting in single core 100% CPU usage.
- Don't do any code styling, if `stdout` is no tty.

## [0.6.1] - 2020-06-14

Expand Down
21 changes: 11 additions & 10 deletions client/output_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ pub fn style_text<T: ToString>(
color: Option<Color>,
attribute: Option<Attribute>,
) -> String {
if is_tty {
let mut styled = style(text.to_string());
if let Some(color) = color {
styled = styled.with(color);
}
if let Some(attribute) = attribute {
styled = styled.attribute(attribute);
}
// No tty, we aren't allowed to do any styling
if !is_tty {
return text.to_string();
}

return styled.to_string();
let mut styled = style(text.to_string());
if let Some(color) = color {
styled = styled.with(color);
}
if let Some(attribute) = attribute {
styled = styled.attribute(attribute);
}

return text.to_string();
styled.to_string()
}

pub fn has_special_columns(tasks: &BTreeMap<usize, Task>) -> (bool, bool) {
Expand Down

0 comments on commit 03bc451

Please sign in to comment.