aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/bump.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/bump.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/bump.rs')
-rw-r--r--crates/mozart/src/commands/bump.rs41
1 files changed, 14 insertions, 27 deletions
diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs
index f295cd9..b322dbe 100644
--- a/crates/mozart/src/commands/bump.rs
+++ b/crates/mozart/src/commands/bump.rs
@@ -1,4 +1,5 @@
use clap::Args;
+use mozart_core::console_format;
use std::collections::HashMap;
use std::path::PathBuf;
@@ -51,24 +52,10 @@ pub async fn execute(
match root.package_type.as_deref() {
Some("project") => {}
Some(pkg_type) => {
- console.info(&format!(
- "{}",
- mozart_core::console::warning(&format!(
- "Warning: Bumping constraints for a non-project package (type=\"{pkg_type}\"). \
- Libraries should not pin their dependencies."
- ))
- ));
+ console.info(&console_format!("<warning>Warning: Bumping constraints for a non-project package (type=\"{pkg_type}\"). Libraries should not pin their dependencies.</warning>"));
}
None if !args.dev_only => {
- console.info(&format!(
- "{}",
- mozart_core::console::warning(
- "Warning: Bumping constraints for a non-project package. \
- No type was set so it defaults to \"library\". \
- Libraries should not pin their dependencies. \
- Consider using --dev-only or setting the type to \"project\"."
- )
- ));
+ console.info(&console_format!("<warning>Warning: Bumping constraints for a non-project package. No type was set so it defaults to \"library\". Libraries should not pin their dependencies. Consider using --dev-only or setting the type to \"project\".</warning>"));
}
None => {}
}
@@ -161,10 +148,10 @@ pub async fn execute(
if total_changes == 0 {
println!(
"{}",
- mozart_core::console::info(&format!(
- "No requirements to update in {}.",
+ console_format!(
+ "<info>No requirements to update in {}.</info>",
composer_json_path.display()
- ))
+ )
);
return Ok(());
}
@@ -172,21 +159,21 @@ pub async fn execute(
if args.dry_run {
println!(
"{}",
- mozart_core::console::info(&format!(
- "{} would be updated with:",
+ console_format!(
+ "<info>{} would be updated with:</info>",
composer_json_path.display()
- ))
+ )
);
for (name, _old, new) in &require_changes {
println!(
"{}",
- mozart_core::console::info(&format!(" - require.{name}: {new}"))
+ console_format!("<info> - require.{name}: {new}</info>")
);
}
for (name, _old, new) in &require_dev_changes {
println!(
"{}",
- mozart_core::console::info(&format!(" - require-dev.{name}: {new}"))
+ console_format!("<info> - require-dev.{name}: {new}</info>")
);
}
// Return exit code 1 when dry-run detects changes (useful for CI to detect un-bumped constraints)
@@ -216,10 +203,10 @@ pub async fn execute(
println!(
"{}",
- mozart_core::console::info(&format!(
- "{} has been updated ({total_changes} changes).",
+ console_format!(
+ "<info>{} has been updated ({total_changes} changes).</info>",
composer_json_path.display()
- ))
+ )
);
Ok(())