From ca571851e4c3e08a2e3ae22f8119ab6446abbb1b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 22 Feb 2026 21:54:20 +0900 Subject: fix(depends): align exit codes and error messages with Composer Return exit code 1 when no dependents are found or no packages are installed, matching Composer's behavior. Align error messages: use "Could not find package" and "There is no installed package depending on" phrasing. Write errors to stderr instead of stdout. Apply the same no-install fix to the prohibits command. Co-Authored-By: Claude Opus 4.6 --- crates/mozart/src/commands/prohibits.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/mozart/src/commands/prohibits.rs') diff --git a/crates/mozart/src/commands/prohibits.rs b/crates/mozart/src/commands/prohibits.rs index ca3bc35..a6a70d5 100644 --- a/crates/mozart/src/commands/prohibits.rs +++ b/crates/mozart/src/commands/prohibits.rs @@ -25,7 +25,7 @@ pub struct ProhibitsArgs { pub async fn execute( args: &ProhibitsArgs, cli: &super::Cli, - _console: &mozart_core::console::Console, + console: &mozart_core::console::Console, ) -> anyhow::Result<()> { let working_dir = match &cli.working_dir { Some(dir) => PathBuf::from(dir), @@ -35,11 +35,12 @@ pub async fn execute( let packages = super::dependency::load_packages(&working_dir, args.locked)?; if packages.is_empty() { - println!( - "{}", - mozart_core::console::info("No packages found. Run `mozart install` first.") + console.write_error( + "No dependencies installed. Try running mozart install or update, or use --locked.", ); - return Ok(()); + return Err(mozart_core::exit_code::bail_silent( + mozart_core::exit_code::GENERAL_ERROR, + )); } // Parse the version constraint the user is asking about -- cgit v1.3.1