aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/self_update.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/mozart/src/commands/self_update.rs')
-rw-r--r--crates/mozart/src/commands/self_update.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs
index 4037355..d5ddda0 100644
--- a/crates/mozart/src/commands/self_update.rs
+++ b/crates/mozart/src/commands/self_update.rs
@@ -1,7 +1,7 @@
use clap::Args;
use mozart_core::MOZART_VERSION;
-use mozart_core::console::Verbosity;
use mozart_core::console_format;
+use mozart_core::console_writeln;
use std::io::Write;
use std::path::{Path, PathBuf};
@@ -278,20 +278,20 @@ async fn update(
// If no explicit version was requested and we're already up-to-date, bail early
if args.version.is_none() && target_version == current_version {
- console.write_stdout(
+ console_writeln!(
+ console,
&console_format!(
"<info>You are already using the latest available Mozart version {current_version} ({channel} channel).</info>"
),
- Verbosity::Normal,
);
if args.clean_backups {
// Preserve the most recent backup
let latest = find_latest_backup(data_dir).ok();
clean_backups(data_dir, latest.as_deref())?;
- console.write_stdout(
+ console_writeln!(
+ console,
&console_format!("<comment>Old backups removed.</comment>"),
- Verbosity::Normal,
);
}
@@ -347,11 +347,11 @@ async fn update(
// tmp is still in scope and will be cleaned up; the replace succeeded
drop(tmp);
- console.write_stdout(
+ console_writeln!(
+ console,
&console_format!(
"<info>Mozart updated successfully from {current_version} to {target_version}</info>"
),
- Verbosity::Normal,
);
console.info(&format!(
"Use `mozart self-update --rollback` to return to version {current_version}"
@@ -359,9 +359,9 @@ async fn update(
if args.clean_backups {
clean_backups(data_dir, Some(&backup_path))?;
- console.write_stdout(
+ console_writeln!(
+ console,
&console_format!("<comment>Old backups removed.</comment>"),
- Verbosity::Normal,
);
}
@@ -391,9 +391,9 @@ fn rollback(
self_replace::self_replace(&backup)
.map_err(|e| anyhow::anyhow!("Could not restore backup: {e}"))?;
- console.write_stdout(
+ console_writeln!(
+ console,
&console_format!("<info>Rollback successful. Restored version {backup_version}</info>"),
- Verbosity::Normal,
);
let _ = current_exe; // suppress unused warning