add a flag to `cargo add` to put dependency in workspace and inherit it
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/cargo/issues/10608)* ### Problem There is no way to tell `cargo add` that you want to add a dependency from a workspace explicitly. It is currently only done implicitly if you run `cargo add foo` and there happens to be a workspace dependency that matches it. There is also no way to add a dependency to a workspace and some of its members at the same time. ### Proposed Solution add flags similar to `--inherit` and `--workspace foo,bar` that explicitly allows you to add a dependency from a workspace and add a dependency to a workspace and some of its members. ### Notes This fell out of #10606. During the discussion of what should be included in cargo add support for workspace inheritance before workspace inheritance gets stabilized. The implementation of this should ideally not happen before stabilization of workspace inheritance. `--inherit`: This would be the main one to add a dependency from a workspace. Usage similar to `cargo add foo --workspace -p bar`, which would add `foo` to `bar` from a workspace. This could error if the workspace does not define that dependency or add it to the workspace if not found. `features` and `optional` are allowed to be used with this. `features` needs to be talked about as it might be good to add it to the workspace dependency features if the workspace dependency is not found. `optional` can only go to the inheriting package. `--workspace foo,bar` This
Posted by Muscraft on Apr 27, 2022, 10:18 PM
Tags
Related issues
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
support (Sysadmin)
Support connecting to remote devcontainers (devcontainer on remote host)
Option to use Waffle menu or links displayed normally
I also attempted to package ROCM on musl.
But why is there no such pushback agains linux kernel?
OpenCode Support
Upcoming changes to the tado° API
Allow Mac users to use Apple native containerization
Support for the Containerization Framework on macOS
add a flag to `cargo add` to put dependency in workspace and inherit it
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/cargo/issues/10608)* ### Problem There is no way to tell `cargo add` that you want to add a dependency from a workspace explicitly. It is currently only done implicitly if you run `cargo add foo` and there happens to be a workspace dependency that matches it. There is also no way to add a dependency to a workspace and some of its members at the same time. ### Proposed Solution add flags similar to `--inherit` and `--workspace foo,bar` that explicitly allows you to add a dependency from a workspace and add a dependency to a workspace and some of its members. ### Notes This fell out of #10606. During the discussion of what should be included in cargo add support for workspace inheritance before workspace inheritance gets stabilized. The implementation of this should ideally not happen before stabilization of workspace inheritance. `--inherit`: This would be the main one to add a dependency from a workspace. Usage similar to `cargo add foo --workspace -p bar`, which would add `foo` to `bar` from a workspace. This could error if the workspace does not define that dependency or add it to the workspace if not found. `features` and `optional` are allowed to be used with this. `features` needs to be talked about as it might be good to add it to the workspace dependency features if the workspace dependency is not found. `optional` can only go to the inheriting package. `--workspace foo,bar` This
Comments (0)
No comments yet. Start the discussion.