Skip to content

Commit

Permalink
Add dispatch for --prerelease to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed Feb 28, 2024
1 parent 2111778 commit 204d45b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rye/src/cli/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ pub struct Args {
#[arg(long, conflicts_with = "dev", conflicts_with = "excluded")]
optional: Option<String>,
/// Include pre-releases when finding a package version.
#[arg(long)]
pre: bool,
#[arg(long, require_equals = true, num_args = 0.., default_missing_value = "allow")]
pre: Option<String>,
/// Overrides the pin operator
#[arg(long)]
pin: Option<Pin>,
Expand Down Expand Up @@ -266,7 +266,7 @@ pub fn execute(cmd: Args) -> Result<(), Error> {
&pyproject_toml,
&py_ver,
&mut requirements,
cmd.pre,
cmd.pre.as_ref(),
output,
&default_operator,
)?;
Expand All @@ -277,7 +277,7 @@ pub fn execute(cmd: Args) -> Result<(), Error> {
&python_path,
&py_ver,
requirement,
cmd.pre,
cmd.pre.as_ref().is_some_and(|it| it == "allow"),
output,
&default_operator,
)?;
Expand Down Expand Up @@ -444,7 +444,7 @@ fn resolve_requirements_with_uv(
pyproject_toml: &PyProject,
py_ver: &PythonVersion,
requirements: &mut [Requirement],
pre: bool,
pre: Option<&String>,
output: CommandOutput,
default_operator: &Operator,
) -> Result<(), Error> {
Expand All @@ -458,8 +458,8 @@ fn resolve_requirements_with_uv(
.arg("--no-header")
.arg("-")
.env("VIRTUAL_ENV", pyproject_toml.venv_path().as_os_str());
if pre {
cmd.arg("--prerelease=allow");
if let Some(it) = pre {
cmd.arg("--prerelease").arg(it);
}
if output == CommandOutput::Quiet {
cmd.arg("-q");
Expand Down

0 comments on commit 204d45b

Please sign in to comment.