From fdd7525e5a0d298ebb8a9aa81cc19ec79e8cd113 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 17 Nov 2022 21:20:09 +0100 Subject: added --clean for update && list downloadfolder --- src/apis/modrinth.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/apis') diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index abb8eec..ec8d203 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs @@ -124,7 +124,6 @@ async fn get(api: String, path: String) -> Result, Box Project { let url = format!("project/{}", name); let data = get(api, url); @@ -143,7 +142,6 @@ pub async fn projects(api: String, ids: Vec) -> Vec { } pub async fn versions(api: String, id: String, list: List) -> Vec { - let loaderstr = match list.modloader { Modloader::Forge => String::from("forge"), Modloader::Fabric => String::from("fabric"), @@ -157,7 +155,7 @@ pub async fn versions(api: String, id: String, list: List) -> Vec { } pub async fn get_raw_versions(api: String, versions: Vec) -> Vec { - println!("Getting versions"); + println!("Getting versions {}", &versions.join(", ")); let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); @@ -169,18 +167,15 @@ pub async fn get_raw_versions(api: String, versions: Vec) -> Vec) -> Result> { match versions.len() { 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), - //TODO compare publish dates 1.. => { let mut times: Vec<(String, DateTime)> = vec![]; for ver in versions { let stamp = DateTime::parse_from_rfc3339(&ver.date_published)?; times.push((ver.id, stamp)) } - dbg!(×); times.sort_by_key(|t| t.1); times.reverse(); - dbg!(×); - println!("CW: {}", times[0].0); + println!("Current Version: {}", times[0].0); Ok(times[0].0.to_string()) }, _ => panic!("available_versions should never be negative"), -- cgit v1.2.3