Allow setting a target version for uv self update (#7252)

## Summary

Resolves #6642 

## Test Plan

```console
❯ cargo build --bin uv --features self-update
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.78s
❯ cp target/debug/uv ~/.cargo/bin
❯ uv self update 0.3.4
info: Checking for updates...
success: Upgraded uv from v0.4.8 to v0.3.4! https://github.com/astral-sh/uv/releases/tag/0.3.4
❯ uv --version
uv 0.3.4 (39f3cd2a9 2024-08-26)
❯ cp target/debug/uv ~/.cargo/bin
❯ uv self update
info: Checking for updates...
success: Upgraded uv from v0.3.4 to v0.4.8! https://github.com/astral-sh/uv/releases/tag/0.4.8
❯ uv --version
uv 0.4.8 (956cadd1a 2024-09-09)
```
This commit is contained in:
Ahmed Ilyas 2024-09-10 15:35:31 +02:00 committed by GitHub
parent 2b3890f2b4
commit bbccee8bee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 7 deletions

View file

@ -418,8 +418,15 @@ pub struct SelfNamespace {
#[derive(Subcommand)]
#[cfg(feature = "self-update")]
pub enum SelfCommand {
/// Update uv to the latest version.
Update,
/// Update uv.
Update(SelfUpdateArgs),
}
#[derive(Args, Debug)]
#[cfg(feature = "self-update")]
pub struct SelfUpdateArgs {
/// Update to the specified version. If not provided, uv will update to the latest version.
pub target_version: Option<String>,
}
#[derive(Args)]