From 2ec20c50e7c02d82b248835988df040bd266b659 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 4 Dec 2022 20:32:51 +0100 Subject: fully added mod remove; fixed update from NONE --- src/apis/modrinth.rs | 7 ------- src/commands/modification.rs | 19 +++++++++++++++++-- src/commands/update.rs | 9 +++++---- src/db.rs | 1 - 4 files changed, 22 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index fb1e666..3880fa0 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs @@ -135,7 +135,6 @@ async fn get(api: String, path: String) -> Result>, Box Project { - println!("!!!PROJECT"); let url = format!("project/{}", name); let data = get(api, url).await.unwrap().unwrap(); @@ -143,11 +142,9 @@ pub async fn project(api: String, name: &str) -> Project { } pub async fn projects(api: String, ids: Vec) -> Vec { - //println!("!!!PROJECTS"); println!("Getting versions for all mods from modrinth"); let all = ids.join(r#"",""#); let url = format!(r#"projects?ids=["{}"]"#, all); - //println!("{}", url); let data = get(api, url).await.unwrap().unwrap(); @@ -155,7 +152,6 @@ pub async fn projects(api: String, ids: Vec) -> Vec { } pub async fn versions(api: String, id: String, list: List) -> Vec { - println!("!!!VERSIONS"); let loaderstr = match list.modloader { Modloader::Forge => String::from("forge"), Modloader::Fabric => String::from("fabric"), @@ -165,8 +161,6 @@ pub async fn versions(api: String, id: String, list: List) -> Vec { let data = get(api, url).await.unwrap(); - dbg!(&data); - match data { Some(data) => serde_json::from_slice(&data).unwrap(), None => Vec::new(), @@ -174,7 +168,6 @@ pub async fn versions(api: String, id: String, list: List) -> Vec { } pub async fn get_raw_versions(api: String, versions: Vec) -> Vec { - println!("!!!RAWVERSIONS"); println!("Getting versions {}", &versions.join(", ")); let url = format!(r#"versions?ids=["{}"]"#, versions.join(r#"",""#)); diff --git a/src/commands/modification.rs b/src/commands/modification.rs index ac23970..f36c8c6 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs @@ -1,6 +1,6 @@ use std::io::{Error, ErrorKind}; -use crate::{modrinth::{project, versions, extract_current_version, Version}, config::Cfg, db::{mods_insert, userlist_remove, mods_get_id, userlist_insert, mods_get_all_ids, userlist_get_all_ids}, input::{Input, Subcmd}, get_current_list, download_versions}; +use crate::{modrinth::{project, versions, extract_current_version, Version}, config::Cfg, db::{mods_insert, userlist_remove, mods_get_id, userlist_insert, mods_get_all_ids, userlist_get_all_ids, userlist_get_current_version, lists_get_all_ids, mods_remove}, input::{Input, Subcmd}, get_current_list, download_versions, files::delete_version}; pub async fn modification(config: Cfg, input: Input) -> Result<(), Box> { @@ -87,6 +87,21 @@ fn remove(config: Cfg, args: Vec) -> Result<(), Box Result<(), Box Result, Box