summaryrefslogtreecommitdiff
path: root/src/commands/modification.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/modification.rs')
-rw-r--r--src/commands/modification.rs35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/commands/modification.rs b/src/commands/modification.rs
index 8f115ee..d20f575 100644
--- a/src/commands/modification.rs
+++ b/src/commands/modification.rs
@@ -3,44 +3,13 @@ use std::collections::HashMap;
3use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; 3use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
4 4
5use crate::{ 5use crate::{
6 config::Cfg, 6 apis::modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, config::Cfg, data::{modification::{AddMod, IDSelector}, project::ProjectInfo}, db::{
7 db::{
8 lists_get_all_ids, mods_get_id, mods_get_info, mods_insert, 7 lists_get_all_ids, mods_get_id, mods_get_info, mods_insert,
9 mods_remove, userlist_get_all_ids, userlist_get_current_version, 8 mods_remove, userlist_get_all_ids, userlist_get_current_version,
10 userlist_insert, userlist_remove, 9 userlist_insert, userlist_remove,
11 }, 10 }, error::{EType, MLErr, MLE}, files::{delete_version, download_versions}, List, PROGRESS_CHARS, STYLE_BAR_POS, STYLE_OPERATION
12 error::{EType, MLErr, MLE},
13 files::{delete_version, download_versions},
14 modrinth::{
15 extract_current_version, get_raw_versions, project, projects, versions,
16 Version,
17 },
18 List, PROGRESS_CHARS, STYLE_BAR_POS, STYLE_OPERATION,
19}; 11};
20 12
21#[derive(Debug)]
22pub struct AddMod {
23 pub id: IDSelector,
24 pub set_version: bool,
25}
26
27#[derive(Debug, PartialEq, Eq)]
28pub enum IDSelector {
29 ModificationID(String),
30 VersionID(String),
31}
32
33#[derive(Debug, Clone)]
34pub struct ProjectInfo {
35 pub mod_id: String,
36 pub slug: String,
37 pub title: String,
38 pub current_version: Option<Version>,
39 pub applicable_versions: Vec<String>,
40 pub download_link: String,
41 pub set_version: bool,
42}
43
44/// # Errors 13/// # Errors
45pub async fn mod_add( 14pub async fn mod_add(
46 config: &Cfg, 15 config: &Cfg,