-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Option to highlight one or several packages in cargo tree
output
#11932
Comments
Out of curiosity. Why do you think this feature should be built-in, given existing tools perform pretty decent today? As I can see, the workflow of this kind of search has a lot of human interactions. That means most users wanting this feature are probably in an interactive session, which is highly possible to have a better tool like |
In my opinion, without it But it should be a simple feature with simple syntax; for complex cases where you need more than simple highlights, users can pipe into all kinds of great tools such as |
Thanks for the reply. I'd like to learn more about this part — “cargo tree is useless on any decent sized project”. How large is it making Let me share mine first. If I want to find a dependency, usually use Okay. Let's see pros and cons of having this feature or not. With existing external tools,
OTOH, with this proposal implemented,
(I made an assumption that people generally know some tools) I always ask myself a question when I come up an idea of a new feature: Does the lack of this feature block somebody's workflow and there is no alternative? I tend to be sold easier when the answer is “yes”. |
Useless was a bad choice of word, I meant to say hard to use on its own. I guess Maybe you are right that this flag is unnecessary and same results could be achieved by a combination of other flags and tools. But IMO, |
As we somehow agree on pros and cons on each solution, I am going to close this as not-planned in order to move things forward. In terms of being an exploratory tool, #11213 may be a good alternative and |
Problem
Sometimes, when trying to figure out an issue with dependencies, it's useful to take a look at
cargo tree
. However, in a big project it takes time to find the package of interest among lots and lots of dependencies. Highlighting a package with color would be very useful in a scenario like this.Proposed Solution
I'd like to propose optional colorized highlighting of packages based on substring search. E.g.,
cargo tree --highlight serde
.Additionally, it may take several substrings and highlight them in different colors, e.g.
cargo tree --highlight serde,cpufeatures
orcargo tree --highlight serde --highlight cpufeatures
Argument of
--highlight
does not have to be an exact match but rather do a substring match, so instead ofserde
I can userde
and matchserde
andrdesktop
.Output should resemble what you can currently achieve using
egrep
and a little regex hack:cargo tree | egrep 'serde|$'
Although this function to some extent is possible to achieve using external tools such as
egrep
, it feels like this should be part of cargo tree itself.Notes
No response
The text was updated successfully, but these errors were encountered: