Problem
cargo add can be a bit annoying when specifying features for multiple crates. For example:
cargo add serde sqlx --features serde/derive sqlx/postgres fails with error: invalid character `/` in dependency name: `sqlx/postgres`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
It's necessary to use one of
$ cargo add serde --features serde/derive sqlx --features sqlx/postgres
$ cargo add serde -F serde/derive sqlx -F sqlx/postgres
$ cargo add serde sqlx -F serde/derive,sqlx/postgres
$ cargo add serde sqlx -F "serde/derive sqlx/postgres"
But those methods are also cumbersome in having to specify the crate name multiple times
Proposed Solution
It would be useful to have a shorthand for specifying features, whether
- Like pip extra's:
cargo add serde[derive] sqlx[postgres,sqlite]
- If we're daring maybe even
cargo add sqlx[-default,postgres,sqlite]
- Like cargo feature or the cargo-edit version of
cargo add: cargo add serde +derive sqlx +postgres +sqlite
- Like specifying
--features: cargo add serde/derive sqlx/postgres,sqlite
- Allowing bare feature names when unambigious:
cargo add serde -F derive sqlx -F postgres -F sqlite
Notes
No response
Problem
cargo addcan be a bit annoying when specifying features for multiple crates. For example:cargo add serde sqlx --features serde/derive sqlx/postgresfails witherror: invalid character `/` in dependency name: `sqlx/postgres`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)It's necessary to use one of
But those methods are also cumbersome in having to specify the crate name multiple times
Proposed Solution
It would be useful to have a shorthand for specifying features, whether
cargo add serde[derive] sqlx[postgres,sqlite]cargo add sqlx[-default,postgres,sqlite]cargo add:cargo add serde +derive sqlx +postgres +sqlite--features:cargo add serde/derive sqlx/postgres,sqlitecargo add serde -F derive sqlx -F postgres -F sqliteNotes
No response