summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/main.rs b/src/main.rs
index 31a320b..0e040b6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -162,7 +162,6 @@ async fn main() {
162 match cli.command { 162 match cli.command {
163 Commands::Mod { command } => { 163 Commands::Mod { command } => {
164 match command { 164 match command {
165 #[allow(unused_variables)]
166 ModCommands::Add { 165 ModCommands::Add {
167 id, 166 id,
168 version, 167 version,
@@ -171,10 +170,10 @@ async fn main() {
171 lock, 170 lock,
172 } => { 171 } => {
173 let listf = match list { 172 let listf = match list {
174 Some(list) => lists_get(config.clone(), list).unwrap(), 173 Some(list) => lists_get(&config, list).unwrap(),
175 None => lists_get( 174 None => lists_get(
176 config.clone(), 175 &config,
177 config_get_current_list(config.clone()).unwrap(), 176 config_get_current_list(&config).unwrap(),
178 ) 177 )
179 .unwrap(), 178 .unwrap(),
180 }; 179 };
@@ -186,18 +185,18 @@ async fn main() {
186 185
187 let add_id = AddMod { id: marked_id, set_version: lock }; 186 let add_id = AddMod { id: marked_id, set_version: lock };
188 187
189 mod_add(config, vec![add_id], listf, download).await 188 mod_add(&config, vec![add_id], listf, download).await
190 } 189 }
191 ModCommands::Remove { id, list } => { 190 ModCommands::Remove { id, list } => {
192 let listf = match list { 191 let listf = match list {
193 Some(list) => lists_get(config.clone(), list).unwrap(), 192 Some(list) => lists_get(&config, list).unwrap(),
194 None => lists_get( 193 None => lists_get(
195 config.clone(), 194 &config,
196 config_get_current_list(config.clone()).unwrap(), 195 config_get_current_list(&config).unwrap(),
197 ) 196 )
198 .unwrap(), 197 .unwrap(),
199 }; 198 };
200 mod_remove(config, &id, listf) 199 mod_remove(&config, &id, listf)
201 } 200 }
202 } 201 }
203 } 202 }
@@ -211,28 +210,28 @@ async fn main() {
211 } => { 210 } => {
212 let ml = match modloader { 211 let ml = match modloader {
213 Some(ml) => Modloader::from(&ml).unwrap(), 212 Some(ml) => Modloader::from(&ml).unwrap(),
214 None => config.clone().defaults.modloader, 213 None => config.defaults.modloader.clone(),
215 }; 214 };
216 215
217 let versions_path = &config.versions; 216 let versions_path = &config.versions;
218 let ver = match version { 217 let ver = match version {
219 Some(ver) => VersionLevel::from(&ver).get(versions_path, cli.force_gameupdate).await.unwrap(), 218 Some(ver) => VersionLevel::from(&ver).get(versions_path, cli.force_gameupdate).await.unwrap(),
220 None => config.clone().defaults.version.get(versions_path, cli.force_gameupdate).await.unwrap(), 219 None => config.defaults.version.clone().get(versions_path, cli.force_gameupdate).await.unwrap(),
221 }; 220 };
222 221
223 list_add(config, id, ver, ml, directory) 222 list_add(&config, &id, &ver, &ml, &directory)
224 } 223 }
225 ListCommands::Remove { id } => list_remove(config, id), 224 ListCommands::Remove { id } => list_remove(&config, id),
226 ListCommands::List => { 225 ListCommands::List => {
227 list_list(config) 226 list_list(&config)
228 } 227 }
229 ListCommands::Change { id } => list_change(config, id), 228 ListCommands::Change { id } => list_change(&config, id),
230 ListCommands::Version { 229 ListCommands::Version {
231 id, 230 id,
232 version, 231 version,
233 download, 232 download,
234 remove, 233 remove,
235 } => list_version(config, id, version, download, remove).await, 234 } => list_version(&config, id, version, download, remove).await,
236 } 235 }
237 } 236 }
238 Commands::Update { 237 Commands::Update {
@@ -244,34 +243,35 @@ async fn main() {
244 } => { 243 } => {
245 let mut liststack: Vec<List> = vec![]; 244 let mut liststack: Vec<List> = vec![];
246 if all { 245 if all {
247 let list_ids = lists_get_all_ids(config.clone()).unwrap(); 246 let list_ids = lists_get_all_ids(&config).unwrap();
248 for id in list_ids { 247 for id in list_ids {
249 liststack.push(lists_get(config.clone(), id).unwrap()); 248 liststack.push(lists_get(&config, id).unwrap());
250 } 249 }
251 } else { 250 } else {
252 let current = match list { 251 let current = match list {
253 Some(l) => lists_get(config.clone(), l).unwrap(), 252 Some(l) => lists_get(&config, l).unwrap(),
254 None => get_current_list(config.clone()).unwrap(), 253 None => get_current_list(&config).unwrap(),
255 }; 254 };
256 liststack.push(current) 255 liststack.push(current)
257 } 256 }
258 update(config, liststack, clean, download, remove).await 257 update(&config, liststack, clean, download, remove).await
259 } 258 }
260 Commands::Download { all, clean, remove, list } => { 259 Commands::Download { all, clean, remove, list } => {
261 let mut liststack: Vec<List> = vec![]; 260 let mut liststack: Vec<List> = vec![];
262 if all { 261 if all {
263 let list_ids = lists_get_all_ids(config.clone()).unwrap(); 262 let list_ids = lists_get_all_ids(&config).unwrap();
264 for id in list_ids { 263 for id in list_ids {
265 liststack.push(lists_get(config.clone(), id).unwrap()); 264 liststack.push(lists_get(&config, id).unwrap());
266 } 265 }
267 } else { 266 } else {
268 let current = match list { 267 let current = match list {
269 Some(l) => lists_get(config.clone(), l).unwrap(), 268 Some(l) => lists_get(&config, l).unwrap(),
270 None => get_current_list(config.clone()).unwrap(), 269 None => get_current_list(&config).unwrap(),
271 }; 270 };
272 liststack.push(current) 271 liststack.push(current)
273 } 272 }
274 download(config, liststack, clean, remove).await 273
274 download(&config, liststack, clean, remove).await
275 }, 275 },
276 Commands::Import { file, download } => { 276 Commands::Import { file, download } => {
277 let filestr: String = match file { 277 let filestr: String = match file {
@@ -284,9 +284,9 @@ async fn main() {
284 .unwrap(), 284 .unwrap(),
285 }; 285 };
286 286
287 import(config, filestr, download).await 287 import(&config, filestr, download).await
288 } 288 }
289 Commands::Export { list } => export(config, list), 289 Commands::Export { list } => export(&config, list),
290 Commands::Test => Ok(()), 290 Commands::Test => Ok(()),
291 } 291 }
292 .unwrap(); 292 .unwrap();