diff options
Diffstat (limited to 'src/commands/setup.rs')
-rw-r--r-- | src/commands/setup.rs | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/commands/setup.rs b/src/commands/setup.rs deleted file mode 100644 index 34da2f8..0000000 --- a/src/commands/setup.rs +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | use std::{fs::File, path::Path}; | ||
2 | |||
3 | use crate::{config::Cfg, db::db_setup, error::MLE}; | ||
4 | |||
5 | pub async fn setup(config: Cfg) -> MLE<()> { | ||
6 | let db_file = format!("{}/data.db", config.data); | ||
7 | |||
8 | if !Path::new(&db_file).exists() { | ||
9 | create(config, db_file)?; | ||
10 | } | ||
11 | |||
12 | /* | ||
13 | match s_config_get_version(config.clone()) { | ||
14 | Ok(ver) => { | ||
15 | match ver.as_str() { | ||
16 | "0.2" => to_03(config)?, | ||
17 | "0.3" => to_04(config)?, | ||
18 | _ => return Err(MLError::new(ErrorType::Other, "UNKNOWN_VERSION")) | ||
19 | } | ||
20 | }, | ||
21 | Err(..) => to_02(config).await? | ||
22 | }; | ||
23 | */ | ||
24 | |||
25 | Ok(()) | ||
26 | } | ||
27 | |||
28 | fn create(config: Cfg, db_file: String) -> MLE<()> { | ||
29 | println!("Create database"); | ||
30 | |||
31 | File::create(db_file)?; | ||
32 | db_setup(config)?; | ||
33 | Ok(()) | ||
34 | } | ||
35 | |||
36 | //async fn to_02(config: Cfg) -> Result<(), Box<dyn std::error::Error>> { | ||
37 | // let lists = lists_get_all_ids(config.clone())?; | ||
38 | // | ||
39 | // for list in lists { | ||
40 | // println!("Updating {}", list); | ||
41 | // s_insert_column(config.clone(), String::from(&list), String::from("current_download"), String::from("TEXT"), None)?; | ||
42 | // | ||
43 | // let full_list = lists_get(config.clone(), String::from(&list))?; | ||
44 | // | ||
45 | // let versions = userlist_get_all_current_version_ids(config.clone(), full_list.clone().id)?; | ||
46 | // | ||
47 | // let raw_versions = get_raw_versions(String::from(&config.apis.modrinth), versions).await; | ||
48 | // | ||
49 | // for ver in raw_versions { | ||
50 | // println!("Adding link for {}", ver.project_id); | ||
51 | // let file = ver.files.into_iter().find(|f| f.primary).unwrap(); | ||
52 | // s_userlist_update_download(config.clone(), String::from(&full_list.id), ver.project_id, file.url)?; | ||
53 | // } | ||
54 | // }; | ||
55 | // s_config_create_version(config)?; | ||
56 | // | ||
57 | // Ok(()) | ||
58 | //} | ||
59 | // | ||
60 | //fn to_03(config: Cfg) -> Result<(), Box<dyn std::error::Error>> { | ||
61 | // s_insert_column(config.clone(), String::from("lists"), String::from("download_folder"), String::from("TEXT"), None)?; | ||
62 | // s_config_update_version(config, String::from("0.3")) | ||
63 | //} | ||
64 | // | ||
65 | //fn to_04(config: Cfg) -> Result<(), Box<dyn std::error::Error>> { | ||
66 | // for list_id in lists_get_all_ids(config.clone())? { | ||
67 | // s_insert_column(config.clone(), list_id, String::from("disabled_versions"), String::from("TEXT"), Some(String::from("NONE")))?; | ||
68 | // } | ||
69 | // s_config_update_version(config, String::from("0.4")) | ||
70 | //} | ||