aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/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/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/update.rs')
-rw-r--r--crates/mozart/src/commands/update.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs
index 7fbec1c..8bd694b 100644
--- a/crates/mozart/src/commands/update.rs
+++ b/crates/mozart/src/commands/update.rs
@@ -1,5 +1,6 @@
use clap::Args;
use mozart_core::console;
+use mozart_core::console_format;
use mozart_core::package::{self, Stability};
use mozart_registry::lockfile;
use mozart_registry::resolver::{self, PlatformConfig, ResolveRequest, ResolvedPackage};
@@ -703,13 +704,13 @@ pub async fn execute(
// Step 2: Handle deprecated flags
if args.dev {
- console.info(&console::warning(
- "The --dev option is deprecated. Dev packages are updated by default.",
+ console.info(&console_format!(
+ "<warning>The --dev option is deprecated. Dev packages are updated by default.</warning>"
));
}
if args.no_suggest {
- console.info(&console::warning(
- "The --no-suggest option is deprecated and has no effect.",
+ console.info(&console_format!(
+ "<warning>The --no-suggest option is deprecated and has no effect.</warning>"
));
}
@@ -810,10 +811,10 @@ pub async fn execute(
match lockfile::LockFile::read_from_file(&lock_path) {
Ok(l) => Some(l),
Err(e) => {
- console.info(&console::warning(&format!(
- "Could not read existing composer.lock: {}. Treating as a fresh install.",
+ console.info(&console_format!(
+ "<warning>Could not read existing composer.lock: {}. Treating as a fresh install.</warning>",
e
- )));
+ ));
None
}
}
@@ -879,8 +880,8 @@ pub async fn execute(
if args.interactive {
match &old_lock {
None => {
- console.info(&console::warning(
- "No lock file found. --interactive mode skipped.",
+ console.info(&console_format!(
+ "<warning>No lock file found. --interactive mode skipped.</warning>"
));
vec![]
}
@@ -1121,8 +1122,8 @@ pub async fn execute(
.map(|s| s.eq_ignore_ascii_case("source"))
.unwrap_or(false);
if prefer_source {
- console.info(&mozart_core::console::warning(
- "Warning: Source installs are not yet supported. Falling back to dist.",
+ console.info(&console_format!(
+ "<warning>Warning: Source installs are not yet supported. Falling back to dist.</warning>"
));
}