aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/bump.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 21:40:38 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 21:42:00 +0900
commitb6347171c9ceaf508d28ffd40fac241970a1c981 (patch)
tree380fbdd0d657fbdfe5d270bd2b62e0b3b69df4b8 /crates/mozart/src/commands/bump.rs
parente7ca97f8d8b0a2e92235771657e48157e5257f2c (diff)
downloadphp-mozart-b6347171c9ceaf508d28ffd40fac241970a1c981.tar.gz
php-mozart-b6347171c9ceaf508d28ffd40fac241970a1c981.tar.zst
php-mozart-b6347171c9ceaf508d28ffd40fac241970a1c981.zip
fix(bump): align output messages with Composer output
- "Nothing to bump." → "No requirements to update in <path>." - "N constraint(s) bumped successfully." → "<path> has been updated (N changes)." - Dry-run now shows "<path> would be updated with:" followed by " - require.<pkg>: <ver>" per change, matching Composer's format - Also update bump message in update command for consistency 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.rs45
1 files changed, 25 insertions, 20 deletions
diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs
index 105379f..f295cd9 100644
--- a/crates/mozart/src/commands/bump.rs
+++ b/crates/mozart/src/commands/bump.rs
@@ -159,31 +159,36 @@ pub async fn execute(
let total_changes = require_changes.len() + require_dev_changes.len();
if total_changes == 0 {
- println!("Nothing to bump.");
+ println!(
+ "{}",
+ mozart_core::console::info(&format!(
+ "No requirements to update in {}.",
+ composer_json_path.display()
+ ))
+ );
return Ok(());
}
- // Print what would change
- for (name, old, new) in require_changes.iter().chain(require_dev_changes.iter()) {
- if args.dry_run {
+ if args.dry_run {
+ println!(
+ "{}",
+ mozart_core::console::info(&format!(
+ "{} would be updated with:",
+ composer_json_path.display()
+ ))
+ );
+ for (name, _old, new) in &require_changes {
println!(
- "{}: {} → {}",
- mozart_core::console::info(name),
- old,
- mozart_core::console::comment(new)
+ "{}",
+ mozart_core::console::info(&format!(" - require.{name}: {new}"))
);
- } else {
+ }
+ for (name, _old, new) in &require_dev_changes {
println!(
- "Bumping {} from {} to {}",
- mozart_core::console::info(name),
- old,
- mozart_core::console::comment(new)
+ "{}",
+ mozart_core::console::info(&format!(" - require-dev.{name}: {new}"))
);
}
- }
-
- if args.dry_run {
- println!("\n{} constraint(s) would be bumped.", total_changes);
// Return exit code 1 when dry-run detects changes (useful for CI to detect un-bumped constraints)
return Err(mozart_core::exit_code::bail_silent(
mozart_core::exit_code::GENERAL_ERROR,
@@ -210,10 +215,10 @@ pub async fn execute(
updated_lock.write_to_file(&lock_path)?;
println!(
- "\n{}",
+ "{}",
mozart_core::console::info(&format!(
- "{} constraint(s) bumped successfully.",
- total_changes
+ "{} has been updated ({total_changes} changes).",
+ composer_json_path.display()
))
);