aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/prohibits.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 21:54:20 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 21:54:20 +0900
commitca571851e4c3e08a2e3ae22f8119ab6446abbb1b (patch)
tree1fbebb43d0285dcd3095e272b0dc81c79f27a85c /crates/mozart/src/commands/prohibits.rs
parent23356a21acee0fa78df2c09847e14f463666462d (diff)
downloadphp-mozart-ca571851e4c3e08a2e3ae22f8119ab6446abbb1b.tar.gz
php-mozart-ca571851e4c3e08a2e3ae22f8119ab6446abbb1b.tar.zst
php-mozart-ca571851e4c3e08a2e3ae22f8119ab6446abbb1b.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/prohibits.rs')
-rw-r--r--crates/mozart/src/commands/prohibits.rs11
1 files changed, 6 insertions, 5 deletions
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