Giter Club home page Giter Club logo

Comments (3)

orf avatar orf commented on May 27, 2024 1

Hey! Yeah I’m definitely in favour of doing this if possible. This would be a great clean up 🧹. This code was added before ratatui existed, and if they have the same functionality then we should use it.

Regarding the differences in name conventions, we could add a switch statement to convert “light-red” to “lightred” or make a PR to add these aliases to ratatui?

from gping.

TieWay59 avatar TieWay59 commented on May 27, 2024

The difference in the error caption:

ratatui: Failed to parse Colors
gping: Invalid color code: `{}`

This error is easy to wrap & handle:

error => Some(error.map_err(|err| {
    anyhow!(err).context(format!("Invalid color code: `{}`", name))
})),
> ./gping www.google.com www.baidu.com -c "red,yello"                                       07/10/2023 03:32:12 PM
Error: Invalid color code: `yello`

Caused by:
    Failed to parse Colors

Or even simpler:

_ => Some(Err(anyhow!("Invalid color code: `{}`", name))),
> ./gping www.google.com www.baidu.com -c "red,yello"                                     1 07/10/2023 03:32:17 PM
Error: Invalid color code: `yello`

Which case would like @orf?

The difference in the color name conventions:

ratatui: "lightred" | "light red"
gping: "light-red"

from gping.

TieWay59 avatar TieWay59 commented on May 27, 2024

Hey! Yeah I’m definitely in favour of doing this if possible. This would be a great clean up broom. This code was added before ratatui existed, and if they have the same functionality then we should use it.

Regarding the differences in name conventions, we could add a switch statement to convert “light-red” to “lightred” or make a PR to add these aliases to ratatui?

I'm not sure because the naming convention may not be a standard for the framework, we can definitely work around it by replacing the -, and I'll try to ask for opinions from upstream~

Personally, I believe ratatui is not very mature in this part, because some same colors can have different expressions in their enum model. That would be way too much to discuss.

from gping.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.