diff options
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)?; |