rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.5k stars 2.37k forks source link

Add short flag `-w` for `--workspace` #11554

Open SUPERCILEX opened 1 year ago

SUPERCILEX commented 1 year ago

See discussion here: https://github.com/rust-lang/cargo/pull/11549

Key points:

Thus, we're blocked on https://github.com/rust-lang/cargo/issues/9339

epage commented 1 year ago

We talked specifically about consistency with cargo update -w in the cargo team meeting. We felt that improving consistency is important which precludes any other command having a -w that isn't a short for --workspace.

We did not decide how to resolve the inconsistency on the existing -w flag, whether we feel that -w was a mistake that slipped in (and we would want to deprecate) or is something we want to push for in the rest of cargo. That was a wider conversation than we were prepared for and had time for.

epage commented 1 year ago

To help move the conversation forward, I personally feel the remaining points are

est31 commented 2 months ago

I feel the --workspace flag is way too long to type it out on a regular basis and I've never started to use it. I use --all instead, for example when I want to ensure that I'm not regressing the build of one of the crates in the workspace before making a PR (default-members defaults to all workspace members but it could in theory have been set to a subset). I don't really agree that --all is confusing, but I'm still okay with the removal as long as there is some short alternative to it. Being forced onto --workspace feels like a regression to me.

If -w is not good (say you want to use it for cargo watch), what about --ws?

I feel the same about foo.workspace = true by the way. foo = "ws" as alias for foo.workspace = true would be really wonderful. If you have a bunch of crates like foo.workspace = true then it's hard to scan the dependencies (and hard to add new dependencies because you have to type these long words). ws is not a valid semver version, and if you want to specify features you can still do foo = { workspace = true, feature = ["a"]}, like how you do foo = { version = "1.0", feature = ["a"]} today.