aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/config_helpers.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-05 16:51:50 +0900
committernsfisis <nsfisis@gmail.com>2026-05-05 16:51:50 +0900
commit4f78e6c6497135cbc2923089ee26f5a50e43f06a (patch)
tree72d0bf2e188d5675d895b1d2aace447dd585b748 /crates/mozart/src/commands/config_helpers.rs
parent2ad57b7efb685040b24d93aab5b81ddfbd0ebefb (diff)
downloadphp-mozart-4f78e6c6497135cbc2923089ee26f5a50e43f06a.tar.gz
php-mozart-4f78e6c6497135cbc2923089ee26f5a50e43f06a.tar.zst
php-mozart-4f78e6c6497135cbc2923089ee26f5a50e43f06a.zip
refactor(commands): consolidate working_dir resolution into Cli method
Diffstat (limited to 'crates/mozart/src/commands/config_helpers.rs')
-rw-r--r--crates/mozart/src/commands/config_helpers.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/crates/mozart/src/commands/config_helpers.rs b/crates/mozart/src/commands/config_helpers.rs
index 2f856a7..c5cd187 100644
--- a/crates/mozart/src/commands/config_helpers.rs
+++ b/crates/mozart/src/commands/config_helpers.rs
@@ -3,14 +3,6 @@ use std::path::{Path, PathBuf};
pub(crate) use mozart_core::composer::composer_home;
-/// Build the working directory path, preferring `--working-dir` over `cwd`.
-pub(crate) fn working_dir(cli: &super::Cli) -> anyhow::Result<PathBuf> {
- match &cli.working_dir {
- Some(d) => Ok(PathBuf::from(d)),
- None => Ok(std::env::current_dir()?),
- }
-}
-
/// 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.
@@ -20,7 +12,7 @@ pub(crate) fn load_tls_options(cli: &super::Cli) -> mozart_core::http::TlsOption
let home = composer_home();
apply_tls_from_file(&home.join("config.json"), &home, &mut opts);
- if let Ok(wd) = working_dir(cli) {
+ if let Ok(wd) = cli.working_dir() {
apply_tls_from_file(&wd.join("composer.json"), &wd, &mut opts);
}