-
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
Limit the number of crate features that are displayed as result of cargo add
#12617
Comments
Sounds interesting. How bad is it now, could you share some screenshots? |
Following the link for web-sys
1566 is nuts. I think, at minimum, we should show the enabled features. If so, we should make sure we indicate that it isn't all. The question is how we should deal with this
When the list is long like this, I feel like there is little value to first/last. The chance that any of those features matter is probabilistically small. I would lean towards Option 3 (only showing
We could generically link out to Also, a link might be fairly long for putting in output mixed with text. My proposal is that we use ANSI escape codes for embedding a link to Short term, we should probably do this via If need be, we could decouple this link work from the rest of the work so we don't block the whole thing. |
If there aren't any concerns, my proposal is
I'm willing to help mentor someone on this so I've marked it as Accepted. You can reach me here, on zulip, or during office hours |
@epage I think I could tackle this throughout this week and next week given some extra information and some style/convention guidance. I just have a few questions regarding your proposal:
I understood this as "Show all enabled features regardless of the hard coded limit", but won't this lead to the same problem as this issue describes if someone enables a lot of features? If that's acceptable, then so be it. Otherwise we could do something similar to what I propose below, just with a different message.
If I understood the above correctly, may I suggest renaming it to "... X more deactivated features"?
vs
We can also print "... 123 more active features" if we wanna collapse active features too. I won't claim this just yet in case someone else can get to it before I do, but I'll try to get to it soon enough. |
I like explicitly stating "deactivating". My assumption is someone won't have hundreds of activated features but I'm fine protecting against it by applying the limit to those as well and showing "X activated features\nX deactivated features". I would assume the For myself, I don't see what benefit we'd be providing the user by listing some of the category that is collapsed ( |
@rustbot claim |
@Angelin01 the difference is in
Showing the the partial feature lists in these long lists seems to have little utility and I was wanting it to not be there. As an implementation note, |
I think understand. Should we just go with something like
Or would you rather we aggregate it just on one message? My issue with that is that I feel like it changes the behavior of the output considerably based on some arbitrary threshold. How useful are those 5 ~ 10 features that we displayed as enabled in the original output versus the possibly 50 or more we collapsed? |
When activated features is above the limit, yes. There are a couple of states
If the threshold is high enough, then there is no concern because the size is so large that its unusable. Keep in mind, |
This remains the same as before:
Should look like this:
I feel like these look fine. Also, Github doesn't let us show this through comments, but both |
Since we are on the topic of "useful information", I noticed during the previous development that 50, visually, still feels like a lot. On a 1080p monitor with a size 10pt font, that fills about 80% of my screen with a maximized terminal. I feel like most people running Edit:
|
Let's go with 30. We can always tweak it in the future (for me |
Why not try to read |
I'd recommend |
It seems Cargo already depends on that crate, so it should be simple enough to add. I'd need to see how much complexity it adds during testing though. |
Any opinion on the formats exemplified here? If no one is opposed, I'll consider it settled. I'll also assume to stick to no color on the summarized messages. I'll open a draft PR with the new changes soon if we are OK. I'll try to use |
Yes, those examples are what I am envisioning.
I wouldn't consider terminal_size as required for the initial implementation. |
Problem
Some crates have way too many features (such as web-sys).
cargo add
lists every feature when adding a crate and could potentially even overflow terminal buffer (it just did for me with web-sys using console)Proposed Solution
Limit the number of features that are displayed. The limit should preferably be configurable but a hard-coded one is also fine.
If the feature list is truncated, cargo should link to docs.rs feature list for that crate
Notes
No response
The text was updated successfully, but these errors were encountered: