From d8cb7bc5f9c2e01c82f954427a60da6eaf0610ca Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Fri, 25 Nov 2022 15:52:20 +0100 Subject: added direct download --- src/input.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 0b616d4..0946971 100644 --- a/src/input.rs +++ b/src/input.rs @@ -7,18 +7,16 @@ pub struct Input { pub subcommand: Option, pub args: Option>, pub direct_download: bool, - pub force_download: bool, pub all_lists: bool, pub delete_old: bool, pub clean: bool, } impl Input { - pub fn from(string: &str) -> MLE { + fn from(string: &str) -> MLE { let mut split: Vec<&str> = string.split(' ').collect(); let mut direct_download = false; - let mut force_download = false; let mut all_lists = false; let mut delete_old = false; let mut clean = false; @@ -27,9 +25,8 @@ impl Input { if input.starts_with("--") { match input { "--direct-download" => direct_download = true, - "--force-download" => force_download = true, - "--all_lists" => all_lists = true, - "--delete_old" => delete_old = true, + "--all-lists" => all_lists = true, + "--delete-old" => delete_old = true, "--clean" => clean = true, _ => continue, } @@ -54,7 +51,7 @@ impl Input { } }; - Ok(Self { command, subcommand, args, direct_download, force_download, all_lists, delete_old, clean }) + Ok(Self { command, subcommand, args, direct_download, all_lists, delete_old, clean }) } } @@ -68,7 +65,7 @@ pub enum Cmd { } impl Cmd { - pub fn from(string: &str) -> MLE { + fn from(string: &str) -> MLE { let cmd = match string { "mod" => Self::Mod, "list" => Self::List, @@ -130,6 +127,6 @@ pub async fn get_input(config: Cfg) -> Result<(), Box> { #[test] fn input_from() { let string = "list add test 1.19.2 fabric"; - let input = Input{ command: Cmd::List, subcommand: Some(Subcmd::Add), args: Some(vec![String::from("test"), String::from("1.19.2"), String::from("fabric")]), force_download: false, direct_download: false, all_lists: false, clean: false, delete_old: false }; + let input = Input{ command: Cmd::List, subcommand: Some(Subcmd::Add), args: Some(vec![String::from("test"), String::from("1.19.2"), String::from("fabric")]), direct_download: false, all_lists: false, clean: false, delete_old: false }; assert_eq!(Input::from(string).unwrap(), input); } -- cgit v1.2.3