From d8554e30029bf43dccce72e982784cd01857b0c4 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 25 May 2023 22:48:54 +0200 Subject: added mod add progress --- src/commands/io.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/commands/io.rs') 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 { } impl ExportList { - pub fn from(config: &Cfg, list_id: String, download: bool) -> MLE { - let list = lists_get(config, String::from(&list_id))?; + pub fn from(config: &Cfg, list_id: &str, download: bool) -> MLE { + let list = lists_get(config, list_id)?; let mut dl_folder = None; if download { dl_folder = Some(list.download_folder) }; - let mods = userlist_get_all_ids(config, &list_id)?; + let mods = userlist_get_all_ids(config, list_id)?; let mut versions = vec![]; for m in mods { - versions.push(ExportVersion::from(config, &list_id, &m)?) + versions.push(ExportVersion::from(config, list_id, &m)?) } Ok(Self { @@ -68,11 +68,11 @@ pub fn export(config: &Cfg, list: Option) -> MLE<()> { if list.is_none() { list_ids = lists_get_all_ids(config)?; } else { - list_ids.push(lists_get(config, list.unwrap())?.id); + list_ids.push(lists_get(config, &list.unwrap())?.id); } let mut lists: Vec = vec![]; for list_id in list_ids { - lists.push(ExportList::from(config, list_id, true)?); + lists.push(ExportList::from(config, &list_id, true)?); } let toml = toml::to_string(&Export { lists })?; @@ -85,7 +85,7 @@ pub fn export(config: &Cfg, list: Option) -> MLE<()> { Ok(()) } -pub async fn import(config: &Cfg, file_str: String, direct_download: bool) -> MLE<()> { +pub async fn import(config: &Cfg, file_str: &str, direct_download: bool) -> MLE<()> { let mut file = File::open(file_str)?; let mut content = String::new(); file.read_to_string(&mut content)?; -- cgit v1.2.3