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/install.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'crates/mozart/src/commands/install.rs') diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs index a759e2b..91d73e0 100644 --- a/crates/mozart/src/commands/install.rs +++ b/crates/mozart/src/commands/install.rs @@ -10,7 +10,7 @@ use mozart_registry::installer_executor::{ }; use mozart_registry::lockfile; use std::collections::BTreeMap; -use std::path::{Path, PathBuf}; +use std::path::Path; #[derive(Args)] pub struct InstallArgs { @@ -159,14 +159,6 @@ pub struct InstallOp<'a> { pub action: Action, } -/// Resolve the working directory from the CLI option, falling back to cwd. -pub fn resolve_working_dir(cli: &super::Cli) -> PathBuf { - match &cli.working_dir { - Some(dir) => PathBuf::from(dir), - None => std::env::current_dir().expect("Failed to determine current directory"), - } -} - /// Compute install operations by comparing locked packages against installed packages. /// /// Returns a tuple of (ops, removals) where: @@ -1333,7 +1325,7 @@ pub async fn execute( mozart_registry::cache::Cache::repo(&cache_config), )); let mut executor = FilesystemExecutor::new(mozart_registry::cache::Cache::files(&cache_config)); - let working_dir = resolve_working_dir(cli); + let working_dir = cli.working_dir()?; run( &working_dir, None, -- cgit v1.3.1