diff options
author | FxQnLr <[email protected]> | 2023-01-11 17:21:08 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2023-01-11 17:21:08 +0100 |
commit | 92bda65a9983e60036b3d49333e9bfe9bcd0543f (patch) | |
tree | 423494ff75fe6ef7fecb30fb2188ab6af8178277 /src/commands | |
parent | 89193143f90e1b8cbb91445d14942fa39509acbb (diff) | |
download | modlist-92bda65a9983e60036b3d49333e9bfe9bcd0543f.tar modlist-92bda65a9983e60036b3d49333e9bfe9bcd0543f.tar.gz modlist-92bda65a9983e60036b3d49333e9bfe9bcd0543f.zip |
begin of mc_version api impl
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/list.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs index 526b434..a02f8b1 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}}; | 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}; |
4 | 4 | ||
5 | #[derive(Debug, Clone, PartialEq, Eq)] | 5 | #[derive(Debug, Clone, PartialEq, Eq)] |
6 | pub struct List { | 6 | pub struct List { |
@@ -26,7 +26,7 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::E | |||
26 | remove(config, input.args.ok_or("")?) | 26 | remove(config, input.args.ok_or("")?) |
27 | }, | 27 | }, |
28 | Subcmd::Version => { | 28 | Subcmd::Version => { |
29 | match version(config, input.args.ok_or("NO_VERSION")?).await { | 29 | match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await { |
30 | Ok(..) => Ok(()), | 30 | Ok(..) => Ok(()), |
31 | Err(e) => Err(Box::new(e)) | 31 | Err(e) => Err(Box::new(e)) |
32 | } | 32 | } |
@@ -85,10 +85,10 @@ fn remove(config: Cfg, args: Vec<String>) -> Result<(), Box<dyn std::error::Erro | |||
85 | /// | 85 | /// |
86 | /// * `config` - The current config | 86 | /// * `config` - The current config |
87 | /// * `args` - All args, to extract the new version | 87 | /// * `args` - All args, to extract the new version |
88 | async fn version(config: Cfg, args: Vec<String>) -> MLE<()> { | 88 | async fn version(config: Cfg, args: Option<Vec<String>>, version_type: Option<MCVersionType>) -> MLE<()> { |
89 | let current_list = lists_get(config.clone(), config_get_current_list(config.clone())?)?; | 89 | let current_list = lists_get(config.clone(), config_get_current_list(config.clone())?)?; |
90 | 90 | ||
91 | lists_version(config.clone(), String::from(¤t_list.id), String::from(&args[0]))?; | 91 | lists_version(config.clone(), String::from(¤t_list.id), String::from(&args.unwrap()[0]))?; |
92 | //update the list & with -- args | 92 | //update the list & with -- args |
93 | cmd_update(config, vec![current_list], true, true, false).await | 93 | cmd_update(config, vec![current_list], true, true, false).await |
94 | } | 94 | } |