summaryrefslogtreecommitdiff
path: root/src/commands/list.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/list.rs')
-rw-r--r--src/commands/list.rs38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs
index 80e801a..13176f4 100644
--- a/src/commands/list.rs
+++ b/src/commands/list.rs
@@ -1,4 +1,12 @@
1use crate::{db::{lists_insert, lists_remove, config_change_current_list, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, update, error::MLE}; 1use crate::{
2 config::Cfg,
3 db::{
4 config_change_current_list, config_get_current_list, lists_get, lists_insert, lists_remove,
5 lists_version,
6 },
7 error::MLE,
8 update, Modloader,
9};
2 10
3#[derive(Debug, Clone, PartialEq, Eq)] 11#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct List { 12pub struct List {
@@ -13,7 +21,13 @@ pub fn get_current_list(config: Cfg) -> MLE<List> {
13 lists_get(config, id) 21 lists_get(config, id)
14} 22}
15 23
16pub fn list_add(config: Cfg, id: String, mc_version: String, modloader: Modloader, directory: String) -> MLE<()> { 24pub fn list_add(
25 config: Cfg,
26 id: String,
27 mc_version: String,
28 modloader: Modloader,
29 directory: String,
30) -> MLE<()> {
17 lists_insert(config, id, mc_version, modloader, directory) 31 lists_insert(config, id, mc_version, modloader, directory)
18} 32}
19 33
@@ -30,15 +44,27 @@ pub fn list_remove(config: Cfg, id: String) -> MLE<()> {
30///Changing the current lists version and updating it 44///Changing the current lists version and updating it
31/// 45///
32/// #Arguments 46/// #Arguments
33/// 47///
34/// * `config` - The current config 48/// * `config` - The current config
35/// * `args` - All args, to extract the new version 49/// * `args` - All args, to extract the new version
36pub async fn list_version(config: Cfg, id: String, mc_version: String, download: bool, delete: bool) -> MLE<()> { 50pub async fn list_version(
37 println!("Change version for list {} to minecraft version: {}", id, mc_version); 51 config: Cfg,
52 id: String,
53 mc_version: String,
54 download: bool,
55 delete: bool,
56) -> MLE<()> {
57 println!(
58 "Change version for list {} to minecraft version: {}",
59 id, mc_version
60 );
38 61
39 lists_version(config.clone(), &id, &mc_version)?; 62 lists_version(config.clone(), &id, &mc_version)?;
40 63
41 println!("\nCheck for updates for new minecraft version in list {}", id); 64 println!(
65 "\nCheck for updates for new minecraft version in list {}",
66 id
67 );
42 let list = lists_get(config.clone(), id)?; 68 let list = lists_get(config.clone(), id)?;
43 update(config, vec![list], true, download, delete).await 69 update(config, vec![list], true, download, delete).await
44} 70}