mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-27 02:17:08 +00:00
Reframe --locked and --frozen as --check operations for uv lock (#9662)
Closes https://github.com/astral-sh/uv/issues/7639
This commit is contained in:
parent
00a4adfc46
commit
84285b69e6
4 changed files with 37 additions and 21 deletions
|
|
@ -3042,22 +3042,26 @@ pub struct SyncArgs {
|
|||
#[derive(Args)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
pub struct LockArgs {
|
||||
/// Assert that the `uv.lock` will remain unchanged.
|
||||
/// Check if the lockfile is up-to-date.
|
||||
///
|
||||
/// 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")]
|
||||
pub locked: bool,
|
||||
/// Asserts that the `uv.lock` would remain unchanged after a resolution. If the lockfile is
|
||||
/// 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")]
|
||||
pub check: bool,
|
||||
|
||||
/// Assert that a `uv.lock` exists, without updating it.
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
/// Assert that a `uv.lock` exists without checking if it is up-to-date.
|
||||
///
|
||||
/// Equivalent to `--frozen`.
|
||||
#[arg(long, alias = "frozen", env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "check")]
|
||||
pub check_exists: bool,
|
||||
|
||||
/// Perform a dry run, without writing the lockfile.
|
||||
///
|
||||
/// In dry-run mode, uv will resolve the project's dependencies and report on the resulting
|
||||
/// changes, but will not write the lockfile to disk.
|
||||
#[arg(long, conflicts_with = "frozen", conflicts_with = "locked")]
|
||||
#[arg(long, conflicts_with = "check_exists", conflicts_with = "check")]
|
||||
pub dry_run: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
|
|||
|
|
@ -990,8 +990,8 @@ impl LockSettings {
|
|||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub(crate) fn resolve(args: LockArgs, filesystem: Option<FilesystemOptions>) -> Self {
|
||||
let LockArgs {
|
||||
locked,
|
||||
frozen,
|
||||
check,
|
||||
check_exists,
|
||||
dry_run,
|
||||
resolver,
|
||||
build,
|
||||
|
|
@ -1005,8 +1005,8 @@ impl LockSettings {
|
|||
.unwrap_or_default();
|
||||
|
||||
Self {
|
||||
locked,
|
||||
frozen,
|
||||
locked: check,
|
||||
frozen: check_exists,
|
||||
dry_run,
|
||||
python: python.and_then(Maybe::into_option),
|
||||
refresh: Refresh::from(refresh),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue