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

fix(error): Never show unrequested color #2965

Merged
merged 1 commit into from Oct 30, 2021
Merged

fix(error): Never show unrequested color #2965

merged 1 commit into from Oct 30, 2021

Conversation

epage
Copy link
Member

@epage epage commented Oct 29, 2021

If the user prints a raw error, it may include color even if the user
turned it off at runtime. Now we'll be more conservative and never show
color for raw errors.

This is a follow up to #2943; apparently I had missed some cases.

If the user prints a raw error, it may include color even if the user
turned it off at runtime.  Now we'll be more conservative and never show
color for raw errors.

This is a follow up to clap-rs#2943; apparently I had missed some cases.
Copy link
Member

@pksunkara pksunkara left a comment

Choose a reason for hiding this comment

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

This should be okay for now but ideally we would want all these errors to read the color from the app.

I tried looking into doing that a week or 2 ago, but it wasn't easy enough and might need a bit more refactor.

bors r+

@epage
Copy link
Member Author

epage commented Oct 29, 2021

This should be okay for now but ideally we would want all these errors to read the color from the app.

I tried looking into doing that a week or 2 ago, but it wasn't easy enough and might need a bit more refactor.

The new Error::format API helps. We can make it so ColorChoice is set on the Colorizer as Error::format time. I'm already doing something similar for WaitOnError to unify the exit experiences. This requires the user to explicitly keep their app and do Error::format.

The parser/validator proposal will also help because it will move the value_of_t errors earlier in the process where the App still exists.

@pksunkara
Copy link
Member

The parser/validator proposal will also help because it will move the value_of_t errors earlier in the process where the App still exists.

That's what I was thinking too

@bors
Copy link
Contributor

bors bot commented Oct 30, 2021

Build succeeded:

@bors bors bot merged commit 2ce9161 into clap-rs:master Oct 30, 2021
@epage epage deleted the auto branch October 30, 2021 00:23
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.

None yet

2 participants