From ecac6d7b4b8899ec349766f154dc097db069c27e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 22 Feb 2026 23:44:10 +0900 Subject: 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 --- crates/mozart/src/commands/outdated.rs | 6 ++++++ crates/mozart/src/commands/show.rs | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'crates/mozart/src') 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()?, -- cgit v1.3.1