diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 23:44:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 23:44:10 +0900 |
| commit | ecac6d7b4b8899ec349766f154dc097db069c27e (patch) | |
| tree | 95fc49772e48e838db8a254f4e3a54523f5577f8 /crates/mozart/src/commands/outdated.rs | |
| parent | 25f8933762de7fce3ce71718d19bced0cde435ae (diff) | |
| download | php-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/mozart/src/commands/outdated.rs')
| -rw-r--r-- | crates/mozart/src/commands/outdated.rs | 6 |
1 files changed, 6 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()?, |
