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

Support colorless help #668

Merged
merged 2 commits into from
Dec 6, 2020
Merged

Conversation

xanonid
Copy link
Contributor

@xanonid xanonid commented Oct 16, 2020

Closes: #600

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution!

src/app.rs Outdated
@@ -1,10 +1,17 @@
use clap::{crate_version, App, AppSettings, Arg};

pub fn build_app() -> App<'static, 'static> {
let clap_color_setting =
if atty::is(atty::Stream::Stdout) && std::env::var_os("NO_COLOR").is_none() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clap does an isatty check internally, because fd --help | cat is not colored at the moment. So I guess we could remove the atty::is(…) part here (as well as the build dependency)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isatty check removed (and rebased).

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update.

Could you please add a CHANGELOG entry (see CONTRIBUTING.md section that I just added).

@sharkdp sharkdp merged commit 441a235 into sharkdp:master Dec 6, 2020
@sharkdp
Copy link
Owner

sharkdp commented Dec 6, 2020

Nevermind, I will add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"-c never" and NO_COLOR are not respected for -h and other usage messages
2 participants