mirror of https://github.com/astral-sh/uv
feat(self-update): show old version in update message (#6473)
## Summary Indicate the previous version from which uv was upgraded when running `uv self update`. Thought that it could be useful in some situations to have a trace of the previous version that was installed. ## Test Plan Did not find a way to test this, since this heavily relies on being able to use the installation script and the ability to publish artifacts for a specific tag.
This commit is contained in:
parent
bbcd10d3cc
commit
7edd78c797
|
|
@ -74,14 +74,24 @@ pub(crate) async fn self_update(printer: Printer) -> Result<ExitStatus> {
|
||||||
// available version of uv.
|
// available version of uv.
|
||||||
match updater.run().await {
|
match updater.run().await {
|
||||||
Ok(Some(result)) => {
|
Ok(Some(result)) => {
|
||||||
|
let version_information = if let Some(old_version) = result.old_version {
|
||||||
|
format!(
|
||||||
|
"from {} to {}",
|
||||||
|
format!("v{old_version}").bold().white(),
|
||||||
|
format!("v{}", result.new_version).bold().white(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!("to {}", format!("v{}", result.new_version).bold().white())
|
||||||
|
};
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
printer.stderr(),
|
printer.stderr(),
|
||||||
"{}",
|
"{}",
|
||||||
format_args!(
|
format_args!(
|
||||||
"{}{} Upgraded uv to {}! {}",
|
"{}{} Upgraded uv {}! {}",
|
||||||
"success".green().bold(),
|
"success".green().bold(),
|
||||||
":".bold(),
|
":".bold(),
|
||||||
format!("v{}", result.new_version).bold().white(),
|
version_information,
|
||||||
format!(
|
format!(
|
||||||
"https://github.com/astral-sh/uv/releases/tag/{}",
|
"https://github.com/astral-sh/uv/releases/tag/{}",
|
||||||
result.new_version_tag
|
result.new_version_tag
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue