diff options
Diffstat (limited to 'crates/mozart/src/commands')
| -rw-r--r-- | crates/mozart/src/commands/archive.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/audit.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/base_config.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/browse.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/bump.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/clear_cache.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/config.rs | 8 | ||||
| -rw-r--r-- | crates/mozart/src/commands/config_helpers.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/diagnose.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/dump_autoload.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/exec.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/fund.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/global.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/licenses.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/reinstall.rs | 3 | ||||
| -rw-r--r-- | crates/mozart/src/commands/run_script.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/status.rs | 29 | ||||
| -rw-r--r-- | crates/mozart/src/commands/update.rs | 2 | ||||
| -rw-r--r-- | crates/mozart/src/commands/validate.rs | 2 |
19 files changed, 42 insertions, 35 deletions
diff --git a/crates/mozart/src/commands/archive.rs b/crates/mozart/src/commands/archive.rs index a3311df..7e1697f 100644 --- a/crates/mozart/src/commands/archive.rs +++ b/crates/mozart/src/commands/archive.rs @@ -1,6 +1,6 @@ +use crate::composer::Composer; use clap::Args; use mozart_archiver::{ArchiveManager, ArchivePackage}; -use mozart_core::composer::Composer; use mozart_core::console_writeln; use mozart_core::factory::create_config; use std::borrow::Cow; diff --git a/crates/mozart/src/commands/audit.rs b/crates/mozart/src/commands/audit.rs index df0e5a9..30f0716 100644 --- a/crates/mozart/src/commands/audit.rs +++ b/crates/mozart/src/commands/audit.rs @@ -1,9 +1,9 @@ use std::path::Path; +use crate::composer::Composer; use clap::Args; use indexmap::IndexMap; use mozart_core::advisory::{AbandonedHandling, AuditConfig, AuditFormat}; -use mozart_core::composer::Composer; use mozart_registry::advisory::{AuditOptions, Auditor, PackageInfo}; use mozart_registry::cache::{Cache, build_cache_config}; use mozart_registry::repository::RepositorySet; diff --git a/crates/mozart/src/commands/base_config.rs b/crates/mozart/src/commands/base_config.rs index bfed161..c10e7e7 100644 --- a/crates/mozart/src/commands/base_config.rs +++ b/crates/mozart/src/commands/base_config.rs @@ -1,9 +1,8 @@ use std::path::PathBuf; +use mozart_core::composer::composer_home; use mozart_core::config_source::JsonConfigSource; -use super::config_helpers::composer_home; - /// Mirrors Composer's `BaseConfigCommand`: resolves the target config file path /// and enforces the `--file` ↔ `--global` mutual exclusivity. pub(crate) struct BaseConfigContext { diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs index c4c957b..a8ccab3 100644 --- a/crates/mozart/src/commands/browse.rs +++ b/crates/mozart/src/commands/browse.rs @@ -1,5 +1,5 @@ +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::console::Console; use mozart_core::console_writeln; use mozart_core::console_writeln_error; diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs index 1ed4c54..4722fe2 100644 --- a/crates/mozart/src/commands/bump.rs +++ b/crates/mozart/src/commands/bump.rs @@ -1,6 +1,7 @@ +use crate::composer::Composer; use clap::Args; use indexmap::IndexMap; -use mozart_core::composer::{Composer, LocalRepository}; +use mozart_core::composer::LocalRepository; use mozart_core::console::Console; use mozart_core::{console_writeln, console_writeln_error}; use std::collections::BTreeMap; diff --git a/crates/mozart/src/commands/clear_cache.rs b/crates/mozart/src/commands/clear_cache.rs index 8fdf665..9ee27ed 100644 --- a/crates/mozart/src/commands/clear_cache.rs +++ b/crates/mozart/src/commands/clear_cache.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, path::Path}; +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::console_writeln_error; use mozart_core::factory::create_config; use mozart_registry::cache::Cache; diff --git a/crates/mozart/src/commands/config.rs b/crates/mozart/src/commands/config.rs index 7227556..5012163 100644 --- a/crates/mozart/src/commands/config.rs +++ b/crates/mozart/src/commands/config.rs @@ -1,15 +1,15 @@ +use super::config_helpers::{ + add_repository, read_json_file, remove_repository, render_value, write_json_file, +}; use anyhow::anyhow; use clap::Args; +use mozart_core::composer::composer_home; use mozart_core::config::resolve_references; use mozart_core::console_writeln; use mozart_core::factory::create_config; use std::collections::BTreeMap; use std::path::{Path, PathBuf}; -use super::config_helpers::{ - add_repository, composer_home, read_json_file, remove_repository, render_value, write_json_file, -}; - #[derive(Args)] pub struct ConfigArgs { /// Setting key diff --git a/crates/mozart/src/commands/config_helpers.rs b/crates/mozart/src/commands/config_helpers.rs index fb626f6..32aacdb 100644 --- a/crates/mozart/src/commands/config_helpers.rs +++ b/crates/mozart/src/commands/config_helpers.rs @@ -1,8 +1,7 @@ use anyhow::anyhow; +use mozart_core::composer::composer_home; use std::path::{Path, PathBuf}; -pub(crate) use mozart_core::composer::composer_home; - /// Read TLS-related options (`config.cafile`, `config.capath`) from the merged /// global + local config. Local values override global. Relative paths are /// resolved against the directory of the config file that defined them. diff --git a/crates/mozart/src/commands/diagnose.rs b/crates/mozart/src/commands/diagnose.rs index af18fdc..17a8b78 100644 --- a/crates/mozart/src/commands/diagnose.rs +++ b/crates/mozart/src/commands/diagnose.rs @@ -1,7 +1,7 @@ +use crate::composer::Composer; use clap::Args; use colored::Colorize; use mozart_core::MOZART_VERSION; -use mozart_core::composer::Composer; use mozart_core::config::Config; use mozart_core::config_validator::{ValidatorOptions, validate_manifest}; use mozart_core::console::Console; diff --git a/crates/mozart/src/commands/dump_autoload.rs b/crates/mozart/src/commands/dump_autoload.rs index 0f3366c..7557d37 100644 --- a/crates/mozart/src/commands/dump_autoload.rs +++ b/crates/mozart/src/commands/dump_autoload.rs @@ -1,6 +1,7 @@ +use crate::composer::Composer; use clap::Args; use mozart_autoload::AutoloadGeneratorExt; -use mozart_core::composer::{AutoloadDumpOptions, Composer}; +use mozart_core::composer::AutoloadDumpOptions; use mozart_core::console_writeln; #[derive(Args, Default)] diff --git a/crates/mozart/src/commands/exec.rs b/crates/mozart/src/commands/exec.rs index 27d1a8a..2b3c836 100644 --- a/crates/mozart/src/commands/exec.rs +++ b/crates/mozart/src/commands/exec.rs @@ -1,5 +1,5 @@ +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::console_writeln; use std::path::{Path, PathBuf}; diff --git a/crates/mozart/src/commands/fund.rs b/crates/mozart/src/commands/fund.rs index 1f334b3..90a8418 100644 --- a/crates/mozart/src/commands/fund.rs +++ b/crates/mozart/src/commands/fund.rs @@ -1,5 +1,5 @@ +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::console::{Console, hyperlink}; use mozart_core::console_format; use mozart_core::console_writeln; diff --git a/crates/mozart/src/commands/global.rs b/crates/mozart/src/commands/global.rs index 1a8a5f8..05e8aae 100644 --- a/crates/mozart/src/commands/global.rs +++ b/crates/mozart/src/commands/global.rs @@ -1,4 +1,5 @@ use clap::Args; +use mozart_core::composer::composer_home; #[derive(Args)] pub struct GlobalArgs { @@ -27,7 +28,7 @@ pub async fn execute( } }; - let home = super::config_helpers::composer_home(); + let home = composer_home(); fs::create_dir_all(&home)?; diff --git a/crates/mozart/src/commands/licenses.rs b/crates/mozart/src/commands/licenses.rs index 394cc39..671ce2a 100644 --- a/crates/mozart/src/commands/licenses.rs +++ b/crates/mozart/src/commands/licenses.rs @@ -1,6 +1,6 @@ +use crate::composer::Composer; use clap::Args; use indexmap::IndexMap; -use mozart_core::composer::Composer; use mozart_core::console::Console; use mozart_core::console::hyperlink; use mozart_core::console_writeln; diff --git a/crates/mozart/src/commands/reinstall.rs b/crates/mozart/src/commands/reinstall.rs index ececa96..dc99a91 100644 --- a/crates/mozart/src/commands/reinstall.rs +++ b/crates/mozart/src/commands/reinstall.rs @@ -1,6 +1,7 @@ +use crate::composer::Composer; use clap::Args; use mozart_autoload::AutoloadGeneratorExt; -use mozart_core::composer::{AutoloadDumpOptions, Composer, LocalPackage}; +use mozart_core::composer::{AutoloadDumpOptions, LocalPackage}; use mozart_core::console_format; use mozart_core::validation::package_name_to_regexp; diff --git a/crates/mozart/src/commands/run_script.rs b/crates/mozart/src/commands/run_script.rs index ade389e..e4b701a 100644 --- a/crates/mozart/src/commands/run_script.rs +++ b/crates/mozart/src/commands/run_script.rs @@ -1,5 +1,5 @@ +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::script_events; use mozart_core::{console_writeln, console_writeln_error}; use std::collections::BTreeMap; diff --git a/crates/mozart/src/commands/status.rs b/crates/mozart/src/commands/status.rs index b6802a3..60185cb 100644 --- a/crates/mozart/src/commands/status.rs +++ b/crates/mozart/src/commands/status.rs @@ -1,11 +1,11 @@ +use crate::composer::Composer; use clap::Args; use indexmap::IndexMap; -use mozart_core::composer::{Composer, InstallationSource, LocalPackage}; +use mozart_core::composer::{InstallationSource, LocalPackage}; use mozart_core::console::Console; use mozart_core::console_writeln; use mozart_core::console_writeln_error; use mozart_core::exit_code; -use mozart_registry::download_manager::DownloadManager; use mozart_vcs::version_guesser::VersionGuesser; #[derive(Args)] @@ -26,19 +26,21 @@ pub async fn execute( cli: &super::Cli, console: &Console, ) -> anyhow::Result<()> { - let working_dir = cli.working_dir()?; - let composer = Composer::require(&working_dir)?; + let composer = Composer::require(cli.working_dir()?)?; + let installed_repo = composer.repository_manager().local_repository(); + + let dm = composer.download_manager(); let im = composer.installation_manager(); - let dm = DownloadManager::new(im.vendor_dir().join(".cache").join("git")); - let guesser = VersionGuesser::new(); - let mut errors: IndexMap<String, String> = IndexMap::new(); - let mut unpushed_changes: IndexMap<String, String> = IndexMap::new(); - let mut vcs_version_changes: IndexMap<String, VcsVerChange> = IndexMap::new(); + let mut errors = IndexMap::new(); + let mut unpushed_changes = IndexMap::new(); + let mut vcs_version_changes = IndexMap::new(); + + let guesser = VersionGuesser::new(); for package in installed_repo.get_canonical_packages() { - let Some(downloader) = dm.for_package(package) else { + let Some(downloader) = dm.get_downloader_for_package(package) else { continue; }; let Some(target_dir) = im.get_install_path(package) else { @@ -111,6 +113,7 @@ pub async fn execute( console, "<error>You have changes in the following dependencies:</error>" ); + for (path, changes) in &errors { if verbose { console_writeln!(console, "<info>{path}</info>:"); @@ -126,6 +129,7 @@ pub async fn execute( console, "<warning>You have unpushed changes on the current branch in the following dependencies:</warning>" ); + for (path, changes) in &unpushed_changes { if verbose { console_writeln!(console, "<info>{path}</info>:"); @@ -141,6 +145,7 @@ pub async fn execute( console, "<warning>You have version variations in the following dependencies:</warning>" ); + for (path, change) in &vcs_version_changes { if verbose { let mut prev = if change.previous.version.is_empty() { @@ -173,8 +178,8 @@ pub async fn execute( } let code = (if !errors.is_empty() { 1 } else { 0 }) - | (if !unpushed_changes.is_empty() { 2 } else { 0 }) - | (if !vcs_version_changes.is_empty() { + + (if !unpushed_changes.is_empty() { 2 } else { 0 }) + + (if !vcs_version_changes.is_empty() { 4 } else { 0 diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs index a7c1412..11672fd 100644 --- a/crates/mozart/src/commands/update.rs +++ b/crates/mozart/src/commands/update.rs @@ -1,6 +1,6 @@ +use crate::composer::Composer; use clap::Args; use indexmap::{IndexMap, IndexSet}; -use mozart_core::composer::Composer; use mozart_core::console_format; use mozart_core::package; use mozart_core::platform::is_platform_package; diff --git a/crates/mozart/src/commands/validate.rs b/crates/mozart/src/commands/validate.rs index 3fd1f56..873b371 100644 --- a/crates/mozart/src/commands/validate.rs +++ b/crates/mozart/src/commands/validate.rs @@ -1,5 +1,5 @@ +use crate::composer::Composer; use clap::Args; -use mozart_core::composer::Composer; use mozart_core::config_validator::{ValidationResult, ValidatorOptions, validate_manifest}; use mozart_core::console_format; use mozart_core::console_writeln; |
