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/init.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crates/mozart/src/commands/init.rs') diff --git a/crates/mozart/src/commands/init.rs b/crates/mozart/src/commands/init.rs index 209be4b..3378755 100644 --- a/crates/mozart/src/commands/init.rs +++ b/crates/mozart/src/commands/init.rs @@ -10,7 +10,7 @@ use mozart_core::validation; use mozart_registry::{packagist, version}; use std::collections::BTreeMap; use std::io::{BufRead, Write}; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::process::Command; #[derive(Args)] @@ -68,10 +68,7 @@ pub async fn execute( let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache); let repo_cache = mozart_registry::cache::Cache::repo(&cache_config); - let working_dir = match &cli.working_dir { - Some(dir) => PathBuf::from(dir), - None => std::env::current_dir().context("Failed to get current directory")?, - }; + let working_dir = cli.working_dir()?; let composer_file = working_dir.join("composer.json"); if composer_file.exists() { -- cgit v1.3.1