Bump self-update (#369)

This commit is contained in:
Roey Darwish Dror
2020-05-09 07:22:51 +03:00
committed by GitHub
parent 754402cfac
commit 6cddd57850
4 changed files with 1009 additions and 1184 deletions

View File

@@ -2,7 +2,8 @@ use super::terminal::*;
#[cfg(windows)]
use crate::error::Upgraded;
use anyhow::{bail, Result};
use self_update_crate::backends::github::{GitHubUpdateStatus, Update};
use self_update_crate::backends::github::Update;
use self_update_crate::update::UpdateStatus;
use std::env;
#[cfg(unix)]
use std::os::unix::process::CommandExt;
@@ -22,12 +23,14 @@ pub fn self_update() -> Result<()> {
.show_download_progress(true)
.current_version(self_update_crate::cargo_crate_version!())
.no_confirm(true)
.build()
.and_then(Update::update_extended)?;
.build()?
.update_extended()?;
if let GitHubUpdateStatus::Updated(release) = &result {
println!("\nTopgrade upgraded to {}:\n", release.version());
println!("{}", release.body);
if let UpdateStatus::Updated(release) = &result {
println!("\nTopgrade upgraded to {}:\n", release.version);
if let Some(body) = &release.body {
println!("{}", body);
}
} else {
println!("Topgrade is up-to-date");
}