diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-06 03:38:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-06 04:05:13 +0900 |
| commit | bf96f8292c0e9818c8b5fc8713ca7506e4338a49 (patch) | |
| tree | 61ddecc119ee0ae344eabdb9c0f784cdb3461a44 /crates/mozart/src/commands/self_update.rs | |
| parent | b97e34358be5df05a3db9f5f3ef1502eaa94b1c0 (diff) | |
| download | php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.gz php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.zst php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.zip | |
refactor(console): add write macros and migrate commands to use them
Diffstat (limited to 'crates/mozart/src/commands/self_update.rs')
| -rw-r--r-- | crates/mozart/src/commands/self_update.rs | 22 |
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 |
