treewide: migrate to multi-crate layout

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I11a2103f3530f07409177404577b90136a6a6964
This commit is contained in:
raf 2026-05-03 00:33:21 +03:00
commit d445b1814a
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
68 changed files with 247 additions and 72 deletions

View file

@ -1,51 +0,0 @@
use std::path::{Path, PathBuf};
use crate::{
cli::FetchArgs,
error::Result,
fetch::Fetcher,
ipc::{IpcCoordinator, OperationGuard, OperationType},
model::{Config, LockFile},
};
pub async fn execute(
args: FetchArgs,
lockfile_path: &Path,
config_path: &Path,
) -> Result<()> {
// Load expects directory path, so get parent directory
let lockfile_dir = lockfile_path.parent().unwrap_or_else(|| Path::new("."));
let config_dir = config_path.parent().unwrap_or_else(|| Path::new("."));
let lockfile = LockFile::load(lockfile_dir)?;
let config = Config::load(config_dir)?;
// Create IPC coordinator for this modpack
let working_dir = PathBuf::from(".");
let coordinator = IpcCoordinator::new(&working_dir)?;
// Check for conflicting operations
if coordinator.has_running_operation(OperationType::Fetch) {
// Wait for conflicting operations to complete with timeout
let timeout = std::time::Duration::from_secs(args.timeout.unwrap_or(300));
coordinator
.wait_for_conflicts(OperationType::Fetch, timeout)
.await?;
}
// Register this fetch operation
let operation_id = coordinator.register_operation(OperationType::Fetch)?;
let _guard = OperationGuard::new(coordinator, operation_id);
// Create fetcher with shelve option
let fetcher = Fetcher::new(".")
.with_shelve(args.shelve)
.with_retry(args.retry);
// Fetch all projects (progress indicators handled in fetch.rs)
fetcher.fetch_all(&lockfile, &config).await?;
println!("Fetch complete");
Ok(())
}