aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 23:44:10 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 23:44:10 +0900
commitecac6d7b4b8899ec349766f154dc097db069c27e (patch)
tree95fc49772e48e838db8a254f4e3a54523f5577f8 /crates
parent25f8933762de7fce3ce71718d19bced0cde435ae (diff)
downloadphp-mozart-ecac6d7b4b8899ec349766f154dc097db069c27e.tar.gz
php-mozart-ecac6d7b4b8899ec349766f154dc097db069c27e.tar.zst
php-mozart-ecac6d7b4b8899ec349766f154dc097db069c27e.zip
fix(show,outdated): reject multiple level filters at once
Composer errors when more than one of --major-only, --minor-only, or --patch-only is specified. Mozart was silently giving --major-only precedence. Now both show and outdated commands validate mutual exclusivity with the same error message as Composer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/mozart/src/commands/outdated.rs6
-rw-r--r--crates/mozart/src/commands/show.rs6
2 files changed, 12 insertions, 0 deletions
diff --git a/crates/mozart/src/commands/outdated.rs b/crates/mozart/src/commands/outdated.rs
index 1807435..5c7b691 100644
--- a/crates/mozart/src/commands/outdated.rs
+++ b/crates/mozart/src/commands/outdated.rs
@@ -101,6 +101,12 @@ pub async fn execute(
cli: &super::Cli,
_console: &mozart_core::console::Console,
) -> anyhow::Result<()> {
+ // Validate mutually exclusive level filters
+ let level_count = args.major_only as u8 + args.minor_only as u8 + args.patch_only as u8;
+ if level_count > 1 {
+ anyhow::bail!("Only one of --major-only, --minor-only or --patch-only can be used at once");
+ }
+
let working_dir = match &cli.working_dir {
Some(dir) => PathBuf::from(dir),
None => std::env::current_dir()?,
diff --git a/crates/mozart/src/commands/show.rs b/crates/mozart/src/commands/show.rs
index 7a9eade..4712757 100644
--- a/crates/mozart/src/commands/show.rs
+++ b/crates/mozart/src/commands/show.rs
@@ -105,6 +105,12 @@ pub async fn execute(
cli: &super::Cli,
_console: &mozart_core::console::Console,
) -> anyhow::Result<()> {
+ // Validate mutually exclusive level filters
+ let level_count = args.major_only as u8 + args.minor_only as u8 + args.patch_only as u8;
+ if level_count > 1 {
+ anyhow::bail!("Only one of --major-only, --minor-only or --patch-only can be used at once");
+ }
+
let working_dir = match &cli.working_dir {
Some(dir) => PathBuf::from(dir),
None => std::env::current_dir()?,