Auto update (w/ cli)

This commit is contained in:
veeso
2021-09-12 10:00:56 +02:00
parent 8bb05406c8
commit 06a67de14f
21 changed files with 1093 additions and 215 deletions
+30
View File
@@ -27,6 +27,9 @@
*/
use super::{AuthActivity, FileTransferParams, FileTransferProtocol};
use crate::filetransfer::params::{AwsS3Params, GenericProtocolParams, ProtocolParams};
use crate::system::auto_update::{Update, UpdateStatus};
use tuirealm::tui::style::Color;
impl AuthActivity {
/// ### protocol_opt_to_enum
@@ -151,4 +154,31 @@ impl AuthActivity {
entry_directory: None,
})
}
// -- update install
/// ### install_update
///
/// Install latest termscp version via GUI
pub(super) fn install_update(&mut self) {
// Umount release notes
self.umount_release_notes();
// Mount wait box
self.mount_wait("Installing update. Please wait…");
// Install update
let result = Update::default().show_progress(false).upgrade();
// Umount wait
self.umount_wait();
// Show outcome
match result {
Ok(UpdateStatus::AlreadyUptodate) => {
self.mount_info("termscp is already up to date!", Color::Cyan)
}
Ok(UpdateStatus::UpdateInstalled(ver)) => self.mount_info(
format!("termscp has been updated to version {}!", ver),
Color::Green,
),
Err(err) => self.mount_error(format!("Could not install update: {}", err)),
}
}
}