diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-23 01:23:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-23 01:23:40 +0900 |
| commit | c7a5859e1770dbc7cbc7cb1785c34b880162dfac (patch) | |
| tree | 58081330c415776c9020771f12227889abcffa12 /crates/mozart/src/commands/config.rs | |
| parent | 7372dc668476cde4bcb789e586cb9a65af1afca0 (diff) | |
| download | php-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.tar.gz php-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.tar.zst php-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.zip | |
fix(global): add ~/.composer fallback, XDG auto-detection, and no-arg handling
Rewrite composer_home() with Composer-compatible resolution: detect XDG
environment (any XDG_* var or /etc/xdg), prefer existing directories,
and fall back to ~/.composer for legacy systems. Consolidate duplicate
composer_home_dir() from global.rs into shared config_helpers. Accept
no subcommand gracefully with a helpful error instead of a parse error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/config.rs')
| -rw-r--r-- | crates/mozart/src/commands/config.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/mozart/src/commands/config.rs b/crates/mozart/src/commands/config.rs index 5105fd6..92f9b59 100644 --- a/crates/mozart/src/commands/config.rs +++ b/crates/mozart/src/commands/config.rs @@ -147,7 +147,7 @@ impl ComposerConfig { .unwrap_or("vendor") .to_string(); - let home = composer_home(); + let home = composer_home().to_string_lossy().into_owned(); let cache_dir = self .values @@ -466,7 +466,7 @@ fn resolve_config_file_path(args: &ConfigArgs, cli: &super::Cli) -> anyhow::Resu anyhow::bail!("Cannot combine --global and --file"); } if args.global { - return Ok(PathBuf::from(composer_home()).join("config.json")); + return Ok(composer_home().join("config.json")); } if let Some(ref file) = args.file { return Ok(PathBuf::from(file)); @@ -900,7 +900,7 @@ fn execute_read( let mut config = ComposerConfig::defaults(); if args.global { - let global_config_path = PathBuf::from(composer_home()).join("config.json"); + let global_config_path = composer_home().join("config.json"); let overrides = load_config_section(&global_config_path)?; config.merge(&overrides); } else { |
