-
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
Made hidden features hidden on cargo add
when not activated
#10878
Conversation
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
cargo add
when not activated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
Could you add some tests like the following?
https://github.com/rust-lang/cargo/tree/master/tests/testsuite/cargo_add
Here is the guide to adding UI tests: https://doc.crates.io/contrib/tests/writing.html#ui-tests
shell.write_stderr(format_args!(" {}\n", feat), &ColorSpec::new())?; | ||
let is_hidden = feat.chars().nth(0).map(|c| c == '_').unwrap_or(false); | ||
|
||
if !is_hidden { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this wasn't in the Issue but how about we also show these features when the user has increased the verbosity? We could use config.extra_verbose
for now. Might be good to lower that to just verbose at a later point but that'll require some more rework because it isn't directly exposed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a cool idea and I would love to implement it. However, given the existence of issue #10882 and my inexperience with this project, I'm not sure how to proceed with this PR. Should I wait for the requirements to be clearer before making any more changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend holding off until a determination has been made about #10794.
To add, we should make sure we cover all cases, like when the hidden features are activated and deactivated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/cargo/ops/cargo_add/mod.rs
Outdated
shell.write_stderr(&prefix, &ColorSpec::new())?; | ||
shell.write_stderr('-', &ColorSpec::new().set_bold(true).set_fg(Some(Red)))?; | ||
shell.write_stderr(format_args!(" {}\n", feat), &ColorSpec::new())?; | ||
let is_hidden = feat.chars().nth(0).map(|c| c == '_').unwrap_or(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hiding the feature if its deactivated. In the original issue, I mentioned also hiding the feature if its indirectly activated.
Thoughts?
17faac4
to
3c4fa0b
Compare
Fixes issue #10794.