aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/self_update.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 22:53:09 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 22:53:22 +0900
commit6f3802fd9f39c4e5847d130b4417b5cdfb66972d (patch)
tree166cca2cf0645d280bfa376a513a049c70241dea /crates/mozart/src/commands/self_update.rs
parent1d33728151b282949e7e14646e722d7775de4453 (diff)
downloadphp-mozart-6f3802fd9f39c4e5847d130b4417b5cdfb66972d.tar.gz
php-mozart-6f3802fd9f39c4e5847d130b4417b5cdfb66972d.tar.zst
php-mozart-6f3802fd9f39c4e5847d130b4417b5cdfb66972d.zip
refactor(console): add console_format! proc macro and migrate all commands
Introduce a Symfony Console-style tag macro that replaces verbose patterns like `console::info(&format!("text {name}"))` with `console_format!("<info>text {name}</info>")`. Supports all 6 tag types (info, comment, error, question, highlight, warning) with format argument distribution across multiple tagged segments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/self_update.rs')
-rw-r--r--crates/mozart/src/commands/self_update.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs
index ad9ae74..56e6bf2 100644
--- a/crates/mozart/src/commands/self_update.rs
+++ b/crates/mozart/src/commands/self_update.rs
@@ -1,4 +1,5 @@
use clap::Args;
+use mozart_core::console_format;
use std::io::Write;
use std::path::{Path, PathBuf};
@@ -283,9 +284,9 @@ async fn update(args: &SelfUpdateArgs, current_exe: &Path, data_dir: &Path) -> a
if args.version.is_none() && target_version == current_version {
println!(
"{}",
- mozart_core::console::info(&format!(
- "Mozart is already at the latest version ({current_version})"
- ))
+ console_format!(
+ "<info>Mozart is already at the latest version ({current_version})</info>"
+ )
);
return Ok(());
}
@@ -334,14 +335,17 @@ async fn update(args: &SelfUpdateArgs, current_exe: &Path, data_dir: &Path) -> a
println!(
"{}",
- mozart_core::console::info(&format!(
- "Mozart updated successfully from {current_version} to {target_version}"
- ))
+ console_format!(
+ "<info>Mozart updated successfully from {current_version} to {target_version}</info>"
+ )
);
if args.clean_backups {
clean_backups(data_dir)?;
- println!("{}", mozart_core::console::comment("Old backups removed."));
+ println!(
+ "{}",
+ console_format!("<comment>Old backups removed.</comment>")
+ );
}
Ok(())
@@ -372,10 +376,10 @@ fn rollback(current_exe: &Path, data_dir: &Path) -> anyhow::Result<()> {
println!(
"{}",
- mozart_core::console::info(&format!(
- "Rollback successful. Restored from {}",
+ console_format!(
+ "<info>Rollback successful. Restored from {}</info>",
backup.file_name().unwrap_or_default().to_string_lossy()
- ))
+ )
);
let _ = current_exe; // suppress unused warning