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

Beautify help messages #147

Merged
merged 3 commits into from Jun 8, 2021
Merged

Beautify help messages #147

merged 3 commits into from Jun 8, 2021

Conversation

QuarticCat
Copy link
Contributor

Before:

image

After:

image

If you add AppSettings::ColoredHelp, the output can be better:

image

However, currently this cannot work with your --no-colors flag. See
clap-rs/clap#1880 and clap-rs/clap#1185.

Actually, this not only affects help messages, but also affects error output of clap. (BTW, your current error handling is not consistent with clap's built-in. If you want a more consistent error output, you can check clap::Error. But that will also introduce some problems.)

One compromise is to use NO_COLOR environment variable to disable colors. If you like that, I can commit relative codes.

@QuarticCat
Copy link
Contributor Author

I would like to say that --no-colors is not a good design. Usually we prefer automatically determine outputting colors or not. And add a flag --color=always|auto|never to control that. Although this is also hard to implement for clap's built-in color output.

Copy link
Owner

@bootandy bootandy left a comment

Choose a reason for hiding this comment

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

That's cool I didn't know you could do that.

@bootandy bootandy merged commit c4a73d5 into bootandy:master Jun 8, 2021
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