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

Option for cargo tree to filter out (non-)workspace members #14420

Closed
zeichenreihe opened this issue Aug 18, 2024 · 3 comments · Fixed by #14928
Closed

Option for cargo tree to filter out (non-)workspace members #14420

zeichenreihe opened this issue Aug 18, 2024 · 3 comments · Fixed by #14928
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-tree E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review

Comments

@zeichenreihe
Copy link

Problem

I'm opening this issue because #8105 (comment) said to open one if one wanted that feature.

cargo tree allows with --prune to remove dependencies from the list. However, as mentioned in #8105 (comment) it only takes in SPEC, and not the proposed "non-members" or "members".

This would be useful to have, since it would allow easily viewing the dependency tree with only workspace members.

Proposed Solution

The solution would be adding some argument, that would then take the values both, member, and non-member (as mentioned in #8105 (comment)).

I have no proposed name yet for the argument.

Notes

At the time of writing, there does not exist any such command, see https://github.com/rust-lang/cargo/blob/ba8b39413c74d08494f94a7542fe79aa636e1661/src/doc/src/commands/cargo-tree.md for the cargo tree documentation at the time of writing.

@zeichenreihe zeichenreihe 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 Aug 18, 2024
@epage
Copy link
Contributor

epage commented Aug 19, 2024

This would be useful to have, since it would allow easily viewing the dependency tree with only workspace members.

Could you go into more detail on the use case for this? In what scenarios are you wanting to view a tree of only workspace members?

@epage epage added S-needs-team-input Status: Needs input from team on whether/how to proceed. S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Aug 19, 2024
@zeichenreihe
Copy link
Author

Scenarios:

  • you want to commit your changes to different crates independently of each other, while not creating commits that "reference api from future commits"
  • you want to make a "how the crates here depend on each other" graph to help new contributors

I think the latter justifies it even more.

Yes it's currently possible to even get the same result, but this requires listing all the dependencies of all crates with --prune, which is annoying and doesn't scale well.

@epage epage added S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. labels Aug 19, 2024
@ehuss ehuss added S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Oct 22, 2024
@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2024

The cargo team discussed this issue and felt mildly in favor of supporting such an option. We would like to avoid proliferating too many flags in general. One option we discussed was reusing another flag of --depth workspace to show only to the depth of the workspace members. We felt it would be helpful for being able to see the connections within a large workspace without seeing all the external dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-tree E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants