feat: add comma value-delimiter to with argument in tool run args to allow for multiple arguments in with flag (#7909)
This is to address my own issue #7908 ## Summary This change makes use of the `clap` value_delimiter parser to populate the `with` `Vec<String>` which currently can either only be empty or with 1 value for each `--with` flag. This makes use of the current code structure but allows for multiple arguments with a single `--with` flag. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan Can be tested with the following CLI: ```bash target/debug/uv tool run --with numpy,polars,matplotlib ipython -c "import numpy;import polars;import matplotlib;" ``` And former behavior of multiple `--with` flags are kept ```bash target/debug/uv tool run --with numpy --with polars --with matplotlib ipython -c "import numpy;import polars;import matplotlib;" ``` <!-- How was it tested? --> --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
@@ -2571,7 +2571,7 @@ pub struct RunArgs {
|
||||
/// When used in a project, these dependencies will be layered on top of
|
||||
/// the project environment in a separate, ephemeral environment. These
|
||||
/// dependencies are allowed to conflict with those specified by the project.
|
||||
#[arg(long)]
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub with: Vec<String>,
|
||||
|
||||
/// Run with the given packages installed as editables.
|
||||
@@ -2579,7 +2579,7 @@ pub struct RunArgs {
|
||||
/// When used in a project, these dependencies will be layered on top of
|
||||
/// the project environment in a separate, ephemeral environment. These
|
||||
/// dependencies are allowed to conflict with those specified by the project.
|
||||
#[arg(long)]
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub with_editable: Vec<String>,
|
||||
|
||||
/// Run with all packages listed in the given `requirements.txt` files.
|
||||
@@ -2587,7 +2587,7 @@ pub struct RunArgs {
|
||||
/// The same environment semantics as `--with` apply.
|
||||
///
|
||||
/// Using `pyproject.toml`, `setup.py`, or `setup.cfg` files is not allowed.
|
||||
#[arg(long, value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)]
|
||||
pub with_requirements: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Run the command in an isolated virtual environment.
|
||||
@@ -3373,7 +3373,7 @@ pub struct ToolRunArgs {
|
||||
pub from: Option<String>,
|
||||
|
||||
/// Run with the given packages installed.
|
||||
#[arg(long)]
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub with: Vec<String>,
|
||||
|
||||
/// Run with the given packages installed as editables
|
||||
@@ -3381,11 +3381,11 @@ pub struct ToolRunArgs {
|
||||
/// When used in a project, these dependencies will be layered on top of
|
||||
/// the uv tool's environment in a separate, ephemeral environment. These
|
||||
/// dependencies are allowed to conflict with those specified.
|
||||
#[arg(long)]
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub with_editable: Vec<String>,
|
||||
|
||||
/// Run with all packages listed in the given `requirements.txt` files.
|
||||
#[arg(long, value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)]
|
||||
pub with_requirements: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Run the tool in an isolated virtual environment, ignoring any already-installed tools.
|
||||
@@ -3441,11 +3441,11 @@ pub struct ToolInstallArgs {
|
||||
pub from: Option<String>,
|
||||
|
||||
/// Include the following extra requirements.
|
||||
#[arg(long)]
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub with: Vec<String>,
|
||||
|
||||
/// Run all requirements listed in the given `requirements.txt` files.
|
||||
#[arg(long, value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)]
|
||||
pub with_requirements: Vec<Maybe<PathBuf>>,
|
||||
|
||||
#[command(flatten)]
|
||||
|
||||
Reference in New Issue
Block a user