From 4f78e6c6497135cbc2923089ee26f5a50e43f06a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 5 May 2026 16:51:50 +0900 Subject: refactor(commands): consolidate working_dir resolution into Cli method --- crates/mozart/src/commands/config_helpers.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'crates/mozart/src/commands/config_helpers.rs') 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 { - 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); } -- cgit v1.3.1