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 --- Cargo.lock | 2 +- Cargo.toml | 2 +- data.db | Bin 24576 -> 24576 bytes dl2/Capes-1.4.5+1.19.mric9rDGCw.jar | Bin 0 -> 87580 bytes src/apis/modrinth.rs | 7 ------- src/commands/modification.rs | 19 +++++++++++++++++-- src/commands/update.rs | 9 +++++---- src/db.rs | 1 - 8 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 dl2/Capes-1.4.5+1.19.mric9rDGCw.jar diff --git a/Cargo.lock b/Cargo.lock index 99b0f6c..08f103b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -647,7 +647,7 @@ dependencies = [ [[package]] name = "modlist" -version = "0.3.1" +version = "0.4.0" dependencies = [ "chrono", "config", diff --git a/Cargo.toml b/Cargo.toml index afa7d38..89db1d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "modlist" -version = "0.3.1" +version = "0.4.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/data.db b/data.db index 51f2ff4..cdc265d 100644 Binary files a/data.db and b/data.db differ diff --git a/dl2/Capes-1.4.5+1.19.mric9rDGCw.jar b/dl2/Capes-1.4.5+1.19.mric9rDGCw.jar new file mode 100644 index 0000000..26193e6 Binary files /dev/null and b/dl2/Capes-1.4.5+1.19.mric9rDGCw.jar differ 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