GithubHelp home page GithubHelp logo

Comments (3)

TimonPost avatar TimonPost commented on June 29, 2024

Hello, thanks for the feedback. It is the right behaviour that it does not work for windows. Windows does not support bold / itlalic ... font. I agree that it can be frustrating to change the code for diffrent plarforms.
I'll take it in consideration but am not sure if I should leave the calls empty for windows because than user may think that the function call does not work. And how should I tell the users that these function calls are not working for windows. Maybe I can do it with the commend above the function call or an custom attribute.

If you want to use the bold feature for only unix why not do the folowing:

``

#[cfg(unix)]
  println!("{}", paint("Bold text").bold());

#[cfg(windows)]
  println!("{}", paint("Bold text"));

With this sollution only the unix systems are going to use the bold() call. I will think about it, I'll let you know when I have made an choice.

from crossterm.

Rukenshia avatar Rukenshia commented on June 29, 2024

Yeah that's what I'll do I guess, thanks for the suggestion. A bit weird to have two calls everywhere but that sounds like a reasonable trade-off as I also understand the other PoV.
Thanks!

from crossterm.

TimonPost avatar TimonPost commented on June 29, 2024

That is the normal way of doing it in rust, it is weird I agree to have two calls. And my crate is handling most of the crossplatform operations on the background. I should defenately find another way. of doing this. Also you can use an if stament to check on witch platform you are working. Check this for more info. It seems more nice if you use that in your code to my opinion. The nice thing about using attribute is that if you compile your code for unix/linux than all the code that has an cfg[windows] attribute will not be compiled, and the other way arrount.

from crossterm.

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.