summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-26 17:23:06 +0100
committerfxqnlr <[email protected]>2023-01-26 17:23:06 +0100
commit57ab6addda10a49c18dc09208dfb319c0205e869 (patch)
treeeec6fd465a113d15c819c64a94bc04d425f0e842 /src/commands
parent1890d59428dfcca861ea1b7820411d80cc60d713 (diff)
downloadmodlist-57ab6addda10a49c18dc09208dfb319c0205e869.tar
modlist-57ab6addda10a49c18dc09208dfb319c0205e869.tar.gz
modlist-57ab6addda10a49c18dc09208dfb319c0205e869.zip
Todos; fixed input with "-"
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/modification.rs4
-rw-r--r--src/commands/update.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/commands/modification.rs b/src/commands/modification.rs
index 6a03b35..c194202 100644
--- a/src/commands/modification.rs
+++ b/src/commands/modification.rs
@@ -20,6 +20,7 @@ async fn add(config: Cfg, input: Input) -> MLE<()> {
20 20
21pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, disable_download: bool) -> MLE<()> { 21pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, disable_download: bool) -> MLE<()> {
22 22
23 //Fix printing (its horrible)
23 println!("Adding mod(s) {:?}", mod_id); 24 println!("Adding mod(s) {:?}", mod_id);
24 let projects = if mod_id.len() == 1 { 25 let projects = if mod_id.len() == 1 {
25 vec![project(String::from(&config.apis.modrinth), &mod_id[0]).await] 26 vec![project(String::from(&config.apis.modrinth), &mod_id[0]).await]
@@ -87,7 +88,8 @@ pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, disable_downl
87} 88}
88 89
89fn remove(config: Cfg, input: Input) -> MLE<()> { 90fn remove(config: Cfg, input: Input) -> MLE<()> {
90 91
92 //TODO inplement deletion by slug or title
91 let mod_id = mods_get_id(config.clone(), input.clone().mod_id.unwrap())?; 93 let mod_id = mods_get_id(config.clone(), input.clone().mod_id.unwrap())?;
92 94
93 let version = userlist_get_current_version(config.clone(), input.clone().list.unwrap().id, String::from(&mod_id))?; 95 let version = userlist_get_current_version(config.clone(), input.clone().list.unwrap().id, String::from(&mod_id))?;
diff --git a/src/commands/update.rs b/src/commands/update.rs
index f8bdb82..f71f537 100644
--- a/src/commands/update.rs
+++ b/src/commands/update.rs
@@ -139,6 +139,7 @@ async fn download_updates_test() {
139 139
140 use crate::{modrinth::{Version, VersionFile, Hash, VersionType}, Modloader, List}; 140 use crate::{modrinth::{Version, VersionFile, Hash, VersionType}, Modloader, List};
141 141
142 let config = Cfg::init("modlist.toml").unwrap();
142 let current_list = List { id: String::from("..."), mc_version: String::from("..."), modloader: Modloader::Forge, download_folder: String::from("./dl") }; 143 let current_list = List { id: String::from("..."), mc_version: String::from("..."), modloader: Modloader::Forge, download_folder: String::from("./dl") };
143 144
144 let versions = vec![Version { 145 let versions = vec![Version {
@@ -171,5 +172,5 @@ async fn download_updates_test() {
171 "fabric".to_string() 172 "fabric".to_string()
172 ] 173 ]
173 }]; 174 }];
174 assert!(download_versions(current_list, versions).await.is_ok()) 175 assert!(download_versions(current_list, config, versions).await.is_ok())
175} 176}