diff options
author | fxqnlr <[email protected]> | 2023-05-25 22:48:54 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-05-25 22:48:54 +0200 |
commit | d8554e30029bf43dccce72e982784cd01857b0c4 (patch) | |
tree | 72b4ee26a4f980deb1165e615e47598be017e5fa /src/commands/io.rs | |
parent | 7f1a262999d7a8b7f12a97daf4b6722638dc62a1 (diff) | |
download | modlist-d8554e30029bf43dccce72e982784cd01857b0c4.tar modlist-d8554e30029bf43dccce72e982784cd01857b0c4.tar.gz modlist-d8554e30029bf43dccce72e982784cd01857b0c4.zip |
added mod add progress
Diffstat (limited to 'src/commands/io.rs')
-rw-r--r-- | src/commands/io.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/commands/io.rs b/src/commands/io.rs index 43e642a..45e363e 100644 --- a/src/commands/io.rs +++ b/src/commands/io.rs | |||
@@ -39,18 +39,18 @@ struct ExportList { | |||
39 | } | 39 | } |
40 | 40 | ||
41 | impl ExportList { | 41 | impl ExportList { |
42 | pub fn from(config: &Cfg, list_id: String, download: bool) -> MLE<Self> { | 42 | pub fn from(config: &Cfg, list_id: &str, download: bool) -> MLE<Self> { |
43 | let list = lists_get(config, String::from(&list_id))?; | 43 | let list = lists_get(config, list_id)?; |
44 | 44 | ||
45 | let mut dl_folder = None; | 45 | let mut dl_folder = None; |
46 | if download { | 46 | if download { |
47 | dl_folder = Some(list.download_folder) | 47 | dl_folder = Some(list.download_folder) |
48 | }; | 48 | }; |
49 | 49 | ||
50 | let mods = userlist_get_all_ids(config, &list_id)?; | 50 | let mods = userlist_get_all_ids(config, list_id)?; |
51 | let mut versions = vec![]; | 51 | let mut versions = vec![]; |
52 | for m in mods { | 52 | for m in mods { |
53 | versions.push(ExportVersion::from(config, &list_id, &m)?) | 53 | versions.push(ExportVersion::from(config, list_id, &m)?) |
54 | } | 54 | } |
55 | 55 | ||
56 | Ok(Self { | 56 | Ok(Self { |
@@ -68,11 +68,11 @@ pub fn export(config: &Cfg, list: Option<String>) -> MLE<()> { | |||
68 | if list.is_none() { | 68 | if list.is_none() { |
69 | list_ids = lists_get_all_ids(config)?; | 69 | list_ids = lists_get_all_ids(config)?; |
70 | } else { | 70 | } else { |
71 | list_ids.push(lists_get(config, list.unwrap())?.id); | 71 | list_ids.push(lists_get(config, &list.unwrap())?.id); |
72 | } | 72 | } |
73 | let mut lists: Vec<ExportList> = vec![]; | 73 | let mut lists: Vec<ExportList> = vec![]; |
74 | for list_id in list_ids { | 74 | for list_id in list_ids { |
75 | lists.push(ExportList::from(config, list_id, true)?); | 75 | lists.push(ExportList::from(config, &list_id, true)?); |
76 | } | 76 | } |
77 | 77 | ||
78 | let toml = toml::to_string(&Export { lists })?; | 78 | let toml = toml::to_string(&Export { lists })?; |
@@ -85,7 +85,7 @@ pub fn export(config: &Cfg, list: Option<String>) -> MLE<()> { | |||
85 | Ok(()) | 85 | Ok(()) |
86 | } | 86 | } |
87 | 87 | ||
88 | pub async fn import(config: &Cfg, file_str: String, direct_download: bool) -> MLE<()> { | 88 | pub async fn import(config: &Cfg, file_str: &str, direct_download: bool) -> MLE<()> { |
89 | let mut file = File::open(file_str)?; | 89 | let mut file = File::open(file_str)?; |
90 | let mut content = String::new(); | 90 | let mut content = String::new(); |
91 | file.read_to_string(&mut content)?; | 91 | file.read_to_string(&mut content)?; |