Auto merge of #13434 - epage:add-features, r=weihanglo

fix(add): Ensure users know a feature is being created

Inspired by #13430 and #13411
This commit is contained in:
bors 2024-02-15 18:29:11 +00:00
commit 30addeaa90
14 changed files with 17 additions and 0 deletions

View File

@ -208,6 +208,10 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
let new_feature: toml_edit::Value =
[format!("dep:{dep_name}")].iter().collect();
table[dep_key] = toml_edit::value(new_feature);
options
.config
.shell()
.status("Adding", format!("feature `{dep_key}`"))?;
}
}
}

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package2 v99999.0.0 to optional dependencies.
Adding feature `some-package`

View File

@ -1 +1,2 @@
Adding foo (workspace) to optional dependencies.
Adding feature `foo`

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`

View File

@ -1 +1,2 @@
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`

View File

@ -1 +1,2 @@
Adding foo (workspace) to optional dependencies.
Adding feature `foo`

View File

@ -2,3 +2,4 @@
Features:
+ mouth
+ nose
Adding feature `your-face`

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding my-package v0.1.0 to optional dependencies.
Adding feature `my-package`

View File

@ -2,3 +2,4 @@
Features:
+ mouth
+ nose
Adding feature `your-face`

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding cargo-list-test-fixture-dependency v20.0 to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`

View File

@ -1,2 +1,3 @@
Updating `dummy-registry` index
Adding versioned-package v0.1.1 to optional dependencies.
Adding feature `a1`

View File

@ -1,3 +1,4 @@
Updating git repository `[ROOTURL]/versioned-package`
Adding versioned-package (git) to optional dependencies.
Adding feature `versioned-package`
Updating git repository `[ROOTURL]/versioned-package`

View File

@ -1 +1,2 @@
Adding cargo-list-test-fixture-dependency (local) to optional dependencies.
Adding feature `cargo-list-test-fixture-dependency`