aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/status.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-23 01:47:39 +0900
committernsfisis <nsfisis@gmail.com>2026-02-23 01:47:39 +0900
commit46e7edbdad721b64e5eae66a0788a55264078e43 (patch)
tree8ba8582d50ae827424152dd043ebdfe056f2dbae /crates/mozart/src/commands/status.rs
parentae0f9c3ced9d07964a0bf2fe76f745aacc7dd34a (diff)
downloadphp-mozart-46e7edbdad721b64e5eae66a0788a55264078e43.tar.gz
php-mozart-46e7edbdad721b64e5eae66a0788a55264078e43.tar.zst
php-mozart-46e7edbdad721b64e5eae66a0788a55264078e43.zip
fix(status): align output with Composer stderr/stdout separation and add symlink detection
- Route headers and hints to stderr, package paths to stdout - Show full install path instead of vendor/<name> (M) - Detect symlinked packages and report instead of diffing - Add verbose hint message when not using -v - Replace std::process::exit(1) with bail_silent for proper cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/status.rs')
-rw-r--r--crates/mozart/src/commands/status.rs58
1 files changed, 40 insertions, 18 deletions
diff --git a/crates/mozart/src/commands/status.rs b/crates/mozart/src/commands/status.rs
index e29eda3..acf6ee6 100644
--- a/crates/mozart/src/commands/status.rs
+++ b/crates/mozart/src/commands/status.rs
@@ -38,7 +38,8 @@ struct FileChange {
/// Changes detected for one package.
struct PackageStatus {
- name: String,
+ install_path: String,
+ note: Option<String>,
changes: Vec<FileChange>,
}
@@ -58,7 +59,7 @@ pub async fn execute(
let installed = mozart_registry::installed::InstalledPackages::read(&vendor_dir)?;
if installed.packages.is_empty() {
- println!("No packages installed.");
+ eprintln!("No packages installed.");
return Ok(());
}
@@ -93,6 +94,17 @@ pub async fn execute(
continue;
}
+ // Check if the install path is a symlink — skip archive comparison
+ if install_path.is_symlink() {
+ let note = format!("{} is a symbolic link.", install_path.display());
+ modified_packages.push(PackageStatus {
+ install_path: install_path.to_string_lossy().into_owned(),
+ note: Some(note),
+ changes: Vec::new(),
+ });
+ continue;
+ }
+
if cli.verbose > 0 {
eprintln!(" Checking {} ...", pkg.name);
}
@@ -148,40 +160,50 @@ pub async fn execute(
if !changes.is_empty() {
modified_packages.push(PackageStatus {
- name: pkg.name.clone(),
+ install_path: install_path.to_string_lossy().into_owned(),
+ note: None,
changes,
});
}
}
if modified_packages.is_empty() {
- println!("No local changes");
+ eprintln!("No local changes");
return Ok(());
}
- println!("You have changes in the following dependencies:\n");
+ eprintln!("You have changes in the following dependencies:\n");
for pkg_status in &modified_packages {
- // Show package name with indicator
- println!("vendor/{} (M)", pkg_status.name);
+ if let Some(ref note) = pkg_status.note {
+ println!("{}", note);
+ } else {
+ // Show full install path, matching Composer's format
+ println!("{}", pkg_status.install_path);
- if show_files {
- let mut sorted_changes: Vec<&FileChange> = pkg_status.changes.iter().collect();
- sorted_changes.sort_by_key(|c| c.path.as_str());
+ if show_files {
+ let mut sorted_changes: Vec<&FileChange> = pkg_status.changes.iter().collect();
+ sorted_changes.sort_by_key(|c| c.path.as_str());
- for change in sorted_changes {
- let prefix = match change.kind {
- ChangeKind::Modified => 'M',
- ChangeKind::Added => '+',
- ChangeKind::Removed => '-',
- };
- println!(" {} {}", prefix, change.path);
+ for change in sorted_changes {
+ let prefix = match change.kind {
+ ChangeKind::Modified => 'M',
+ ChangeKind::Added => '+',
+ ChangeKind::Removed => '-',
+ };
+ println!(" {} {}", prefix, change.path);
+ }
}
}
}
+ // Hint about --verbose if not already showing files and there are modified packages
+ if !show_files {
+ eprintln!("Use --verbose (-v) to see a list of files");
+ }
+
// Exit with code 1 if modifications found
- std::process::exit(1);
+ Err(mozart_core::exit_code::bail_silent(1))
}
// ─── Helpers ──────────────────────────────────────────────────────────────────