From fc1cb1acc0dce412e948475002666bcd1d4b0348 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 31 Oct 2022 22:41:18 +0100 Subject: add first impl --- .gitignore | 3 +- Cargo.lock | 322 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 + config.ini | 3 + src/apis/modrinth.rs | 101 ++++++++++++---- src/commands/add.rs | 34 ++++++ src/commands/mod.rs | 3 + src/config.rs | 23 ++++ src/db.rs | 18 +++ src/input.rs | 59 ++++++++++ src/lib.rs | 11 +- src/main.rs | 7 +- src/update.rs | 8 -- 13 files changed, 556 insertions(+), 38 deletions(-) create mode 100644 config.ini create mode 100644 src/commands/add.rs create mode 100644 src/commands/mod.rs create mode 100644 src/config.rs create mode 100644 src/input.rs delete mode 100644 src/update.rs diff --git a/.gitignore b/.gitignore index ebdb388..5682417 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -/api-tests \ No newline at end of file +/api-tests +data.db \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 815536d..4f1f0d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,28 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "async-trait" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -20,6 +42,15 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.11.1" @@ -44,6 +75,25 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "config" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f1667b8320afa80d69d8bbe40830df2c8a06003d86f73d8e003b2c48df416d" +dependencies = [ + "async-trait", + "json5", + "lazy_static", + "nom", + "pathdiff", + "ron", + "rust-ini", + "serde", + "serde_json", + "toml", + "yaml-rust", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -60,6 +110,41 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + [[package]] name = "encoding_rs" version = "0.8.31" @@ -147,6 +232,27 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "h2" version = "0.3.15" @@ -171,6 +277,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] [[package]] name = "hermit-abi" @@ -302,6 +411,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -314,6 +434,12 @@ version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "lock_api" version = "0.4.9" @@ -345,6 +471,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "mio" version = "0.8.5" @@ -361,9 +493,11 @@ dependencies = [ name = "modlist" version = "0.1.0" dependencies = [ + "config", "reqwest", "serde", "serde_json", + "sqlite", "tokio", ] @@ -385,6 +519,16 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num_cpus" version = "1.13.1" @@ -446,6 +590,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -469,12 +623,62 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pest" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" +dependencies = [ + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" +dependencies = [ + "once_cell", + "pest", + "sha1", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -566,6 +770,27 @@ dependencies = [ "winreg", ] +[[package]] +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64", + "bitflags", + "serde", +] + +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + [[package]] name = "ryu" version = "1.0.11" @@ -654,6 +879,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -688,6 +924,36 @@ dependencies = [ "winapi", ] +[[package]] +name = "sqlite" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e66cb949f931ece6201d72bffad3f3601b94998a345793713dd13af70a77c185" +dependencies = [ + "libc", + "sqlite3-sys", +] + +[[package]] +name = "sqlite3-src" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1815a7a02c996eb8e5c64f61fcb6fd9b12e593ce265c512c5853b2513635691" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "sqlite3-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d47c99824fc55360ba00caf28de0b8a0458369b832e016a64c13af0ad9fbb9ee" +dependencies = [ + "libc", + "sqlite3-src", +] + [[package]] name = "syn" version = "1.0.103" @@ -713,6 +979,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "thiserror" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -783,6 +1069,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -815,6 +1110,18 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "ucd-trie" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -853,6 +1160,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "want" version = "0.3.0" @@ -1075,3 +1388,12 @@ checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] diff --git a/Cargo.toml b/Cargo.toml index cc98e0d..bbc0456 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,5 @@ reqwest = { version = "0.11", features = ["json"] } tokio = { version = "1", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.87" +config = "0.13.2" +sqlite = "0.27.3" diff --git a/config.ini b/config.ini new file mode 100644 index 0000000..0ea32d5 --- /dev/null +++ b/config.ini @@ -0,0 +1,3 @@ +[apis] +;modrinth = "http://localhost:8080/" +modrinth = "https://api.modrinth.com/v2/" diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index ce9fdd4..3af5bbd 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs @@ -1,25 +1,6 @@ -use serde::{Deserialize, Serialize}; +use serde::Deserialize; -async fn get(path: String) -> Result, Box> { - dbg!(&path); - let api = String::from("https://api.modrinth.com/v2/"); - //let api = String::from("localhost:8080/"); - //let api = String::from("https://www.rust-lang.org/"); - let url = format!(r#"{}{}"#, api, path); - - println!("{}", &url); - - - let data = reqwest::get(r#"https://api.modrinth.com/v2/projects?ids=["kYuIpRLv","89Wsn8GD"]"#) - .await? - .bytes() - .await? - .to_vec(); - - //println!("body = {:?}", data); - - Ok(data) -} +use crate::Modloader; #[derive(Debug, Deserialize)] pub struct Project { @@ -86,19 +67,89 @@ pub enum Status { processing, unknown } -pub async fn project(name: &str) -> Project { + +#[derive(Debug, Deserialize)] +pub struct Version { + pub name: String, + pub version_number: String, + pub changelog: Option, + pub game_versions: Vec, + pub version_type: VersionType, + pub loaders: Vec, + pub featured: bool, + pub id: String, + pub project_id: String, + pub author_id: String, + pub date_published: String, + pub downloads: u32, + pub files: Vec, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Deserialize)] +pub enum VersionType { + release, + beta, + alpha +} + +#[derive(Debug, Deserialize)] +pub struct VersionFile { + pub hashes: Hash, + pub url: String, + pub filename: String, + pub primary: bool, + pub size: u32, +} + +#[derive(Debug, Deserialize)] +pub struct Hash { + pub sha512: String, + pub sha1: String, +} + +async fn get(api: String, path: String) -> Result, Box> { + let url = format!(r#"{}{}"#, api, path); + + dbg!(&url); + + let data = reqwest::get(url) + .await? + .bytes() + .await? + .to_vec(); + + Ok(data) +} + + +pub async fn project(api: String, name: &str) -> Project { let url = format!("project/{}", name); - let data = get(url); + let data = get(api, url); serde_json::from_slice(&data.await.unwrap()).unwrap() } -pub async fn projects(ids: Vec<&str>) -> Vec { +pub async fn projects(api: String, ids: Vec<&str>) -> Vec { let all = ids.join(r#"",""#); let url = format!(r#"projects?ids=["{}"]"#, all); println!("{}", url); - let data = get(url); + let data = get(api, url); serde_json::from_slice(&data.await.unwrap()).unwrap() } + +pub async fn versions(api: String, id: String, loader: Modloader, mc_version: String) -> Vec { + + let loaderstr = match loader { + Modloader::Forge => String::from("forge"), + Modloader::Fabric => String::from("fabric"), + }; + + let url = format!(r#"project/{}/version?loaders=["{}"]&game_versions=["{}"]"#, id, loaderstr, mc_version); + + let data = get(api, url); + + serde_json::from_slice(&data.await.unwrap()).unwrap() +} diff --git a/src/commands/add.rs b/src/commands/add.rs new file mode 100644 index 0000000..67f63de --- /dev/null +++ b/src/commands/add.rs @@ -0,0 +1,34 @@ +use std::io::{Error, ErrorKind}; + +use crate::{modrinth::{project, versions}, config::Cfg, db::insert_mod, Modloader}; + +pub async fn add(config: Cfg, mc_mod: String) -> Result<(), Box> { + println!("Adding"); + + let project = project(String::from(&config.apis.modrinth), &mc_mod).await; + + dbg!(&project); + + let loader = Modloader::Fabric; + + if project.versions.is_empty() { panic!("This should never happen"); }; + + let current_version = get_current(config, String::from(&project.id)).await?; + + match insert_mod(project.id, project.title, current_version, project.versions, loader, String::from("1.19.2")) { + Err(err) => { Err(Box::new(err)) }, + Ok(()) => Ok(()), + } + +} + +async fn get_current(config: Cfg, id: String) -> Result> { + let available_versions = versions(config.apis.modrinth, id, Modloader::Fabric, String::from("1.19.2")).await; + + match available_versions.len() { + 0 => Err(Box::new(Error::new(ErrorKind::NotFound, "NO_VERSIONS_AVAILABLE"))), + //TODO compare publish dates + 1.. => Ok(available_versions[0].id.to_string()), + _ => panic!("available_versions should never be negative"), + } +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000..0cc183a --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1,3 @@ +pub mod add; + +pub use add::*; diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..a0dfbbe --- /dev/null +++ b/src/config.rs @@ -0,0 +1,23 @@ +use config::{Config, File, FileFormat}; +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +pub struct Cfg { + pub apis: Apis, +} + +#[derive(Debug, Deserialize)] +pub struct Apis { + pub modrinth: String, +} + +impl Cfg { + pub fn init(path: &str) -> Self { + Config::builder() + .add_source(File::new(path, FileFormat::Ini)) + .build() + .unwrap() + .try_deserialize() + .unwrap() + } +} diff --git a/src/db.rs b/src/db.rs index e69de29..3d50b0f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -0,0 +1,18 @@ +use crate::Modloader; + +pub fn insert_mod(id: String, name: String, current_version: String, old_versions: Vec, mod_loader: Modloader, desired_mc_version: String) -> Result<(), sqlite::Error> { + + let connection = sqlite::open("./data.db").unwrap(); + + let loader = match mod_loader { + Modloader::Fabric => "fabric", + Modloader::Forge => "forge", + }; + + let sql = format!("INSERT INTO mods VALUES ('{}', '{}', '{}', '{}', '{}', '{}')", id, name, current_version, old_versions.join("|"), loader, desired_mc_version); + + dbg!(&sql); + + connection.execute(sql) + +} diff --git a/src/input.rs b/src/input.rs new file mode 100644 index 0000000..689389e --- /dev/null +++ b/src/input.rs @@ -0,0 +1,59 @@ +use std::io::{stdin, Error, ErrorKind}; +use crate::{add, config::Cfg}; + +pub struct Input { + pub command: String, + pub args: Option>, +} + +impl Input { + pub fn from(string: String) -> Result> { + let mut split: Vec<&str> = string.split(' ').collect(); + + let command: String; + let mut args: Option> = None; + + if split[0].is_empty() { split.remove(0); }; + + dbg!(&split); + + match split.len() { + 0 => { Err(Box::new(Error::new(ErrorKind::InvalidInput, "NO_ARGS"))) } + 1 => Ok( Input { command: split[0].to_string(), args }), + 2.. => { + command = split[0].to_string(); + split.remove(0); + let mut str_args: Vec = vec![]; + for e in split { + str_args.push(e.to_string()); + } + args = Some(str_args); + Ok(Input { command, args }) + }, + _ => { panic!("This should never happen") } + } + + + } +} + +pub async fn get_input(config: Cfg) -> Result<(), Box> { + let mut user_input = String::new(); + stdin() + .read_line(&mut user_input) + .expect("ERROR"); + + dbg!(&user_input); + + let input = Input::from(user_input.trim().to_string())?; + + match input.command.as_str() { + "add" => { + if input.args == None { return Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_FEW_ARGUMENTS"))) }; + if input.args.as_ref().unwrap().len() != 1 { return Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_MANY_ARGUMENTS"))) }; + add(config, input.args.unwrap()[0].to_string()).await?; + Ok(()) + }, + _ => Err(Box::new(Error::new(ErrorKind::InvalidInput, "UNKNOWN_COMMAND"))), + } +} diff --git a/src/lib.rs b/src/lib.rs index cbb761c..52b0646 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,13 @@ -pub mod update; pub mod apis; +pub mod config; +pub mod commands; +pub mod input; +pub mod db; pub use apis::*; +pub use commands::*; + +pub enum Modloader { + Fabric, + Forge +} diff --git a/src/main.rs b/src/main.rs index 8d1a1bd..957e5aa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,8 @@ -use modlist::modrinth::projects; +use modlist::{config::Cfg, input::get_input}; #[tokio::main] async fn main() { - //projects(vec!["kYuIpRLv", "89Wsn8GD"]); - println!("{:?}", projects(vec!["kYuIpRLv", "89Wsn8GD"]).await); + let config = Cfg::init("config.ini"); + //TODO Error Handling + get_input(config).await.unwrap(); } diff --git a/src/update.rs b/src/update.rs deleted file mode 100644 index 2e70f43..0000000 --- a/src/update.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub fn update_mods() { - -} - -fn get_version(link: String) { - - -} -- cgit v1.2.3