Cargo new --workspace

Fairly simple proposal: add a --workspace flag to cargo that adds the newly created package to workspace.members in the current project’s Cargo.toml.

This small tweak would make workspaces a lot more ergonomic to use.

cargo new detects what workspace a package thinks it will belong to and

  • Adds it to the members
  • Inherits any fields

For creating a workspace, we have Add `cargo new --workspace` to create a workspace · Issue #8365 · rust-lang/cargo · GitHub

3 Likes

will it do that if the [workspace]field doesn't exist yet? because that's the behavior that i want.

It does not; that would be more related to the issue.