rust-cli / book

Documentation on how to use the Rust Programming Language to develop commandline applications
https://rust-cli.github.io/book/index.html
MIT License
815 stars 106 forks source link

Recommend crate to use for color in the CLI #252

Open jayvdb opened 1 month ago

jayvdb commented 1 month ago

CLI usually use color to output different log more visually, e.g. red for error.

Choosing a crate which provides this would be a good inclusion to https://github.com/rust-cli/book/blob/master/src/in-depth/human-communication.md

epage commented 1 month ago

Agreed that we need to add more guidance around colored output.

I'd recommend using anstream as the basis for it. Because its "good enough" and cheap, I'd then probably use anstyle with it.

(anstream uses anstyle, as well as env_logger and clap so its a "common" dependency)