mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Allow uv add
to specify optional dependency groups (#4607)
## Summary Implements `uv add --optional <group>`, which adds a dependency to `project.optional-dependency.<group>`. Resolves https://github.com/astral-sh/uv/issues/4585.
This commit is contained in:
parent
9b38450998
commit
bbd59ff455
8 changed files with 443 additions and 113 deletions
|
@ -1763,9 +1763,13 @@ pub struct AddArgs {
|
|||
pub requirements: Vec<String>,
|
||||
|
||||
/// Add the requirements as development dependencies.
|
||||
#[arg(long)]
|
||||
#[arg(long, conflicts_with("optional"))]
|
||||
pub dev: bool,
|
||||
|
||||
/// Add the requirements to the specified optional dependency group.
|
||||
#[arg(long, conflicts_with("dev"))]
|
||||
pub optional: Option<ExtraName>,
|
||||
|
||||
/// Add the requirements as editables.
|
||||
#[arg(long, default_missing_value = "true", num_args(0..=1))]
|
||||
pub editable: Option<bool>,
|
||||
|
@ -1829,9 +1833,13 @@ pub struct RemoveArgs {
|
|||
pub requirements: Vec<PackageName>,
|
||||
|
||||
/// Remove the requirements from development dependencies.
|
||||
#[arg(long)]
|
||||
#[arg(long, conflicts_with("optional"))]
|
||||
pub dev: bool,
|
||||
|
||||
/// Remove the requirements from the specified optional dependency group.
|
||||
#[arg(long, conflicts_with("dev"))]
|
||||
pub optional: Option<ExtraName>,
|
||||
|
||||
/// Remove the dependency from a specific package in the workspace.
|
||||
#[arg(long, conflicts_with = "isolated")]
|
||||
pub package: Option<PackageName>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue