diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 21:40:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 21:42:00 +0900 |
| commit | b6347171c9ceaf508d28ffd40fac241970a1c981 (patch) | |
| tree | 380fbdd0d657fbdfe5d270bd2b62e0b3b69df4b8 /crates/mozart/src/commands | |
| parent | e7ca97f8d8b0a2e92235771657e48157e5257f2c (diff) | |
| download | php-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')
| -rw-r--r-- | crates/mozart/src/commands/bump.rs | 45 | ||||
| -rw-r--r-- | crates/mozart/src/commands/update.rs | 5 |
2 files changed, 29 insertions, 21 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() )) ); diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs index 7924eca..7fbec1c 100644 --- a/crates/mozart/src/commands/update.rs +++ b/crates/mozart/src/commands/update.rs @@ -1104,7 +1104,10 @@ pub async fn execute( updated_lock.content_hash = new_hash; updated_lock.write_to_file(&lock_path)?; - console.info(&format!("{} constraint(s) bumped.", bumped)); + console.info(&format!( + "{} has been updated ({bumped} changes).", + composer_json_path.display() + )); } } |
