Skip to content

cargo new: option to suppress automatic addition to workspace #14501

@j-n-f

Description

@j-n-f

Problem

This is similar to but not quite the same as #13985

I'm building a tool which calls cargo new as a subprocess. That tool has a root Cargo.toml which specifies a few workspaces.

When testing the tool I do something like cargo run -- new ../some/path or cargo run -- new path. When I do so, cargo new runs as a subprocess and it indicates that it's adding the new package to the workspace list (even if the folder is outside of the project, i.e. "../"). Because I'm only testing, I want to suppress this behaviour.

Without a means to do this, I have to delete the folder, and edit the root Cargo.toml every time I test.

Proposed Solution

99% of the time it seems correct (and convenient), but I'd like a flag or environment variable to suppress this unexpected automatic behaviour.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-workspacesArea: workspacesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions