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

Add color to cargo search #9918

Closed
pintert3 opened this issue Sep 17, 2021 · 0 comments · Fixed by #10425
Closed

Add color to cargo search #9918

pintert3 opened this issue Sep 17, 2021 · 0 comments · Fixed by #10425
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-search

Comments

@pintert3
Copy link

Describe the problem you are trying to solve
cargo search appears to have a --color option which it doesn't use. Now not using it isn't the problem in particular, the lack of color which would be useful is.

Describe the solution you'd like
I think it would be useful to add color the output to make it easier to see descriptions and versions.

@pintert3 pintert3 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Sep 17, 2021
@ehuss ehuss added A-console-output Area: Terminal output, colors, progress bar, etc. Command-search labels Oct 22, 2021
bors added a commit that referenced this issue Feb 28, 2022
feat(search): Highlight search term

This supersedes #10116.  For the requested colored-output tests, this followed the pattern of the `fix` tests which just detects whether colored output is used or not.  The `cache_messages` actually verify the output is colored but that is because it can just compare to a rustc call's output.  Getting the colored output correct by hand in a test (with all of the resets) is a bit messy and would be brittle.

This was done in an exercise in exploring ways to generalize colored output support in preparation for `cargo-add` doing some colored output as well.

I converted all output calls to use this approach, even if coloring wasn't used, for consistency.  I considered coloring the overflow message but decided to hold off on that for now (either a warning-yellow or a hint-gray).

Fixes #9918
@bors bors closed this as completed in 1eb8913 Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-search
Projects
None yet
2 participants