From 1890d59428dfcca861ea1b7820411d80cc60d713 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 22 Jan 2023 22:34:17 +0100 Subject: Added list version cmd, fixed some todos --- src/apis/modrinth.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/apis') diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index 9890cf2..36ab5df 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs @@ -1,4 +1,3 @@ -use std::io::{Error, ErrorKind}; use chrono::{DateTime, FixedOffset}; use reqwest::Client; use serde::Deserialize; @@ -142,7 +141,7 @@ pub async fn project(api: String, name: &str) -> Project { } pub async fn projects(api: String, ids: Vec) -> Vec { - println!("Getting versions for all mods from modrinth"); + println!("\tGet versions from modrinth\n"); let all = ids.join(r#"",""#); let url = format!(r#"projects?ids=["{}"]"#, all); @@ -188,7 +187,7 @@ pub fn extract_current_version(versions: Vec) -> MLE { } times.sort_by_key(|t| t.1); times.reverse(); - println!("Current Version: {}", times[0].0); + println!("\t └New current version: {}", times[0].0); Ok(times[0].0.to_string()) }, _ => panic!("available_versions should never be negative"), @@ -198,6 +197,7 @@ pub fn extract_current_version(versions: Vec) -> MLE { pub enum MCVersionType { Release, Latest, + Specific, } #[derive(Debug, Deserialize)] @@ -220,6 +220,10 @@ pub async fn get_minecraft_version(api: String, version: MCVersionType) -> Strin &mc_versions[i] }, MCVersionType::Latest => &mc_versions[0], + MCVersionType::Specific => { + println!("Not inplemented"); + &mc_versions[0] + } }; String::from(&ver.version) } -- cgit v1.2.3