summaryrefslogtreecommitdiff
path: root/src/commands/setup.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2022-11-28 22:55:14 +0100
committerfxqnlr <[email protected]>2022-11-28 22:55:14 +0100
commitddde9204c72dd867f920f07f6483be03dda7cf68 (patch)
tree51ee1140311be4a82a7832bcef2772db7fd4e639 /src/commands/setup.rs
parentd8cb7bc5f9c2e01c82f954427a60da6eaf0610ca (diff)
downloadmodlist-ddde9204c72dd867f920f07f6483be03dda7cf68.tar
modlist-ddde9204c72dd867f920f07f6483be03dda7cf68.tar.gz
modlist-ddde9204c72dd867f920f07f6483be03dda7cf68.zip
basically update impl; added "good" download;
auto dl on new mod; db to 0.4; etc
Diffstat (limited to 'src/commands/setup.rs')
-rw-r--r--src/commands/setup.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/commands/setup.rs b/src/commands/setup.rs
index be06040..c7f1bed 100644
--- a/src/commands/setup.rs
+++ b/src/commands/setup.rs
@@ -13,6 +13,7 @@ pub async fn setup(config: Cfg) -> Result<(), Box<dyn std::error::Error>> {
13 Ok(ver) => { 13 Ok(ver) => {
14 match ver.as_str() { 14 match ver.as_str() {
15 "0.2" => to_03(config)?, 15 "0.2" => to_03(config)?,
16 "0.3" => to_04(config)?,
16 _ => return Err(Box::new(Error::new(ErrorKind::Other, "UNKNOWN_VERSION"))) 17 _ => return Err(Box::new(Error::new(ErrorKind::Other, "UNKNOWN_VERSION")))
17 } 18 }
18 }, 19 },
@@ -33,7 +34,7 @@ async fn to_02(config: Cfg) -> Result<(), Box<dyn std::error::Error>> {
33 34
34 for list in lists { 35 for list in lists {
35 println!("Updating {}", list); 36 println!("Updating {}", list);
36 s_insert_column(config.clone(), String::from(&list), String::from("current_download"), String::from("TEXT"))?; 37 s_insert_column(config.clone(), String::from(&list), String::from("current_download"), String::from("TEXT"), None)?;
37 38
38 let full_list = lists_get(config.clone(), String::from(&list))?; 39 let full_list = lists_get(config.clone(), String::from(&list))?;
39 40
@@ -53,6 +54,13 @@ async fn to_02(config: Cfg) -> Result<(), Box<dyn std::error::Error>> {
53} 54}
54 55
55fn to_03(config: Cfg) -> Result<(), Box<dyn std::error::Error>> { 56fn to_03(config: Cfg) -> Result<(), Box<dyn std::error::Error>> {
56 s_insert_column(config.clone(), String::from("lists"), String::from("download_folder"), String::from("TEXT"))?; 57 s_insert_column(config.clone(), String::from("lists"), String::from("download_folder"), String::from("TEXT"), None)?;
57 s_config_update_version(config, String::from("0.3")) 58 s_config_update_version(config, String::from("0.3"))
58} 59}
60
61fn to_04(config: Cfg) -> Result<(), Box<dyn std::error::Error>> {
62 for list_id in lists_get_all_ids(config.clone())? {
63 s_insert_column(config.clone(), list_id, String::from("disabled_versions"), String::from("TEXT"), Some(String::from("NONE")))?;
64 }
65 s_config_update_version(config, String::from("0.4"))
66}