Skip to content

Commit

Permalink
fix(cli): conflict --locked with --upgrade (#10836)
Browse files Browse the repository at this point in the history
## Summary

Relates to #10273.

This doesn't solve what is highlighted in
#10273 (comment),
but I believe this is still an improvement for users not setting
`upgrade = true` in `[tool.uv]`.

## Test Plan

Ran commands locally:

```shell
$ cargo run --quiet -- lock --locked --upgrade
error: the argument '--check' cannot be used with '--upgrade'

Usage: uv lock --check

For more information, try '--help'.
```
  • Loading branch information
mkniewallner authored Jan 22, 2025
1 parent a7166ff commit dc637d0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2835,7 +2835,7 @@ pub struct RunArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Run without updating the `uv.lock` file.
Expand Down Expand Up @@ -3058,7 +3058,7 @@ pub struct SyncArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Sync without updating the `uv.lock` file.
Expand Down Expand Up @@ -3130,7 +3130,7 @@ pub struct LockArgs {
/// missing or needs to be updated, uv will exit with an error.
///
/// Equivalent to `--locked`.
#[arg(long, alias = "locked", env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "check_exists")]
#[arg(long, alias = "locked", env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade"])]
pub check: bool,

/// Assert that a `uv.lock` exists without checking if it is up-to-date.
Expand Down Expand Up @@ -3265,7 +3265,7 @@ pub struct AddArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Add dependencies without re-locking the project.
Expand Down Expand Up @@ -3346,7 +3346,7 @@ pub struct RemoveArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Remove dependencies without re-locking the project.
Expand Down Expand Up @@ -3465,7 +3465,7 @@ pub struct TreeArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Display the requirements without locking the project.
Expand Down Expand Up @@ -3682,7 +3682,7 @@ pub struct ExportArgs {
///
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
/// needs to be updated, uv will exit with an error.
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["frozen", "upgrade"])]
pub locked: bool,

/// Do not update the `uv.lock` before exporting.
Expand Down

0 comments on commit dc637d0

Please sign in to comment.