diff options
author | fxqnlr <[email protected]> | 2023-01-15 16:58:45 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-01-15 16:58:45 +0100 |
commit | 30c1ffcecb541d9b27982df6af26948514cbadaa (patch) | |
tree | 11a898fc729bc813059fc8b66b7a27a3e9ec532e /src/commands | |
parent | fad32c31b59001bed46fa860fbc3a994d278e700 (diff) | |
download | modlist-30c1ffcecb541d9b27982df6af26948514cbadaa.tar modlist-30c1ffcecb541d9b27982df6af26948514cbadaa.tar.gz modlist-30c1ffcecb541d9b27982df6af26948514cbadaa.zip |
started implementation of new input system
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/list.rs | 16 | ||||
-rw-r--r-- | src/commands/mod.rs | 20 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs index 3998cce..2fec1c7 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::io::{Error, ErrorKind}; | 1 | use std::io::{Error, ErrorKind}; |
2 | 2 | ||
3 | use crate::{db::{lists_insert, lists_remove, config_change_current_list, lists_get_all_ids, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, input::{Input, Subcmd}, cmd_update, error::{MLE, ErrorType, MLError}, modrinth::MCVersionType}; | 3 | use crate::{db::{lists_insert, lists_remove, config_change_current_list, lists_get_all_ids, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, input::{Input, ListOptions}, /*cmd_update,*/ error::{MLE, ErrorType, MLError}, /*modrinth::MCVersionType*/}; |
4 | 4 | ||
5 | #[derive(Debug, Clone, PartialEq, Eq)] | 5 | #[derive(Debug, Clone, PartialEq, Eq)] |
6 | pub struct List { | 6 | pub struct List { |
@@ -9,20 +9,20 @@ pub struct List { | |||
9 | pub modloader: Modloader, | 9 | pub modloader: Modloader, |
10 | pub download_folder: String, | 10 | pub download_folder: String, |
11 | } | 11 | } |
12 | 12 | /* | |
13 | pub async fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::Error>> { | 13 | pub async fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::Error>> { |
14 | 14 | ||
15 | match input.subcommand.ok_or("")? { | 15 | match input.list_options.ok_or("")? { |
16 | Subcmd::Add => { | 16 | ListOptions::Add => { |
17 | match add(config, input.args.ok_or("")?) { | 17 | match add(config, input.args.ok_or("")?) { |
18 | Ok(..) => Ok(()), | 18 | Ok(..) => Ok(()), |
19 | Err(e) => Err(Box::new(e)) | 19 | Err(e) => Err(Box::new(e)) |
20 | } | 20 | } |
21 | }, | 21 | }, |
22 | Subcmd::Change => { | 22 | ListOptions::Change => { |
23 | change(config, input.args) | 23 | change(config, input.args) |
24 | }, | 24 | }, |
25 | Subcmd::Remove => { | 25 | ListOptions::Remove => { |
26 | match remove(config, input.args.ok_or("")?) { | 26 | match remove(config, input.args.ok_or("")?) { |
27 | Ok(..) => Ok(()), | 27 | Ok(..) => Ok(()), |
28 | Err(e) => Err(Box::new(e)) | 28 | Err(e) => Err(Box::new(e)) |
@@ -39,7 +39,7 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::E | |||
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | */ | |
43 | pub fn get_current_list(config: Cfg) -> MLE<List> { | 43 | pub fn get_current_list(config: Cfg) -> MLE<List> { |
44 | let id = config_get_current_list(config.clone())?; | 44 | let id = config_get_current_list(config.clone())?; |
45 | lists_get(config, id) | 45 | lists_get(config, id) |
@@ -83,6 +83,7 @@ fn remove(config: Cfg, args: Vec<String>) -> MLE<()> { | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | ||
86 | ///Changing the current lists version and updating it | 87 | ///Changing the current lists version and updating it |
87 | /// #Arguments | 88 | /// #Arguments |
88 | /// | 89 | /// |
@@ -95,3 +96,4 @@ async fn version(config: Cfg, args: Option<Vec<String>>, version_type: Option<MC | |||
95 | //update the list & with -- args | 96 | //update the list & with -- args |
96 | cmd_update(config, vec![current_list], true, true, false).await | 97 | cmd_update(config, vec![current_list], true, true, false).await |
97 | } | 98 | } |
99 | */ | ||
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 0d5bd00..29fc600 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | pub mod modification; | 1 | //pub mod modification; |
2 | pub mod list; | 2 | pub mod list; |
3 | pub mod update; | 3 | //pub mod update; |
4 | pub mod setup; | 4 | //pub mod setup; |
5 | pub mod download; | 5 | //pub mod download; |
6 | pub mod io; | 6 | //pub mod io; |
7 | 7 | ||
8 | pub use modification::*; | 8 | //pub use modification::*; |
9 | pub use list::*; | 9 | pub use list::*; |
10 | pub use update::*; | 10 | //pub use update::*; |
11 | pub use setup::*; | 11 | //pub use setup::*; |
12 | pub use download::*; | 12 | //pub use download::*; |
13 | pub use io::*; | 13 | //pub use io::*; |