use thirtyfour::{DesiredCapabilities, WebDriver}; use tracing::{info, error}; use std::{path::Path, process::exit}; use toml::Value; use crate::{errors::CliError, util::{PackConfig, read_pack_lock, self}}; pub async fn check_updates(cfg: PackConfig) -> Result<(), CliError> { info!("Checking for pack updates for {} ({})", cfg.pack.name,cfg.pack.game_version); let mut old_urls: Vec = Vec::new(); if Path::new("./pack.lock").exists() { let lock = read_pack_lock()?; for url in lock.mod_versions.keys() { old_urls.push((&lock.mod_versions.get(url).unwrap_or(&Value::String("none".to_string()))).to_string()); } } else { error!("No pack.lock found, can't check for updates to something that doesn't exist!"); exit(-1); } let mut num_updates: u32 = 0; let caps = DesiredCapabilities::firefox(); let driver = WebDriver::new("http://localhost:9515", caps).await; for url in old_urls { info!("Checking for updates to {}", url); } Ok(()) } pub async fn apply_updates(cfg: PackConfig) -> Result<(), CliError> { info!("Fetching new mod versions and updating pack.lock..."); let mod_urls = util::find_updated_urls(cfg.mods.values(), cfg.pack.game_version).await?; Ok(()) }