Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use termion for dua aggregate coloring on windows #50

Closed
Byron opened this issue Mar 29, 2020 · 0 comments
Closed

Don't use termion for dua aggregate coloring on windows #50

Byron opened this issue Mar 29, 2020 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed windows-support

Comments

@Byron
Copy link
Owner

Byron commented Mar 29, 2020

This is already sufficiently abstracted…

dua-cli/src/common.rs

Lines 117 to 145 in b7ed2bb

pub enum Color {
/// Use no color
None,
/// Use terminal colors
Terminal,
}
pub(crate) struct DisplayColor<C> {
kind: Color,
color: C,
}
impl Color {
pub(crate) fn display<C>(self, color: C) -> DisplayColor<C> {
DisplayColor { kind: self, color }
}
}
impl<C> fmt::Display for DisplayColor<C>
where
C: fmt::Display,
{
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match self.kind {
Color::None => Ok(()),
Color::Terminal => self.color.fmt(f),
}
}
}

…which should make it straightforward to use a 'color-crate' that is cross-platform. Maybe it's possible to use that on linux as well, but it's not mandatory as it would also increase compile times.

Related to #2

@Byron Byron added help wanted Extra attention is needed good first issue Good for newcomers windows-support labels Mar 29, 2020
@Byron Byron closed this as completed Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed windows-support
Projects
None yet
Development

No branches or pull requests

1 participant