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 a flag to cargo add to make it show all features #15178

Open
yshui opened this issue Feb 13, 2025 · 4 comments
Open

add a flag to cargo add to make it show all features #15178

yshui opened this issue Feb 13, 2025 · 4 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-triage Status: This issue is waiting on initial triage.

Comments

@yshui
Copy link

yshui commented Feb 13, 2025

Problem

Currently when a crate has too many features, cargo add only shows part of them and prints "X deactivated features". this is useful if i want to see a concise summary, but sometimes i actually want to see all the available features to see what i can enable.

Proposed Solution

add an new flag to make cargo add print all features. or perhaps make it do so when -v/--verbose is specified.

Notes

No response

@yshui yshui added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Feb 13, 2025
@epage
Copy link
Contributor

epage commented Feb 13, 2025

Can you provide an example of a crate with that large of a feature list that you want to browse?

If we don't support this already, the two most ways to support this that are aligned with cargo would be

  • show it with -v
  • show it with -F (nothing else) except this command takes a positional and we generally don't mix flag/option hybrids with positionals

@yshui
Copy link
Author

yshui commented Feb 15, 2025

Can you provide an example of a crate with that large of a feature list that you want to browse?

reqwest

right now it shows:

    Updating crates.io index
      Adding reqwest v0.12.12 to dependencies
             Features:
             + __tls
             + charset
             + default-tls
             + h2
             + http2
             + macos-system-configuration
             27 deactivated features

@epage
Copy link
Contributor

epage commented Feb 17, 2025

Doing a quick look to see how short-term vs long term that feature count is

There are 4 "private" features which would be aided by #10882.

They are using dep: for each optional dependency, so no accidental features exist

It looks like the different backends are not mutually exclusive but I suspect some aspects might benefit from https://internals.rust-lang.org/t/pre-rfc-mutually-excusive-global-features/19618, reducing the number of features.

@epage
Copy link
Contributor

epage commented Feb 17, 2025

Looking at that example, another option is that we bump the max feature count. The number we chose (30) was arbitrary and was meant to avoid cases like windows with its ~700 features for which a -v or -F may still not be too helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants