diff options
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/input.rs b/src/input.rs index 41b0c29..ffc1213 100644 --- a/src/input.rs +++ b/src/input.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use std::env; | 1 | use std::env; |
2 | use crate::{config::Cfg, list, modification, update, setup, download, error::{MLError, ErrorType, MLE}}; | 2 | use crate::{config::Cfg, list, modification, update, setup, download, io, error::{MLError, ErrorType, MLE}}; |
3 | 3 | ||
4 | #[derive(Debug, Clone, PartialEq, Eq)] | 4 | #[derive(Debug, Clone, PartialEq, Eq)] |
5 | pub struct Input { | 5 | pub struct Input { |
@@ -77,7 +77,8 @@ pub enum Cmd { | |||
77 | List, | 77 | List, |
78 | Update, | 78 | Update, |
79 | Download, | 79 | Download, |
80 | Setup | 80 | Setup, |
81 | Io | ||
81 | } | 82 | } |
82 | 83 | ||
83 | impl Cmd { | 84 | impl Cmd { |
@@ -88,6 +89,7 @@ impl Cmd { | |||
88 | "update" => Self::Update, | 89 | "update" => Self::Update, |
89 | "download" => Self::Download, | 90 | "download" => Self::Download, |
90 | "setup" => Self::Setup, | 91 | "setup" => Self::Setup, |
92 | "io" => Self::Io, | ||
91 | _ => return Err(MLError::new(ErrorType::ArgumentError, "Unknown command")) | 93 | _ => return Err(MLError::new(ErrorType::ArgumentError, "Unknown command")) |
92 | }; | 94 | }; |
93 | Ok(cmd) | 95 | Ok(cmd) |
@@ -98,7 +100,9 @@ impl Cmd { | |||
98 | pub enum Subcmd { | 100 | pub enum Subcmd { |
99 | Add, | 101 | Add, |
100 | Remove, | 102 | Remove, |
101 | Change | 103 | Change, |
104 | Export, | ||
105 | Import, | ||
102 | } | 106 | } |
103 | 107 | ||
104 | impl Subcmd { | 108 | impl Subcmd { |
@@ -107,6 +111,8 @@ impl Subcmd { | |||
107 | "add" => Self::Add, | 111 | "add" => Self::Add, |
108 | "remove" => Self::Remove, | 112 | "remove" => Self::Remove, |
109 | "change" => Self::Change, | 113 | "change" => Self::Change, |
114 | "export" => Self::Export, | ||
115 | "import" => Self::Import, | ||
110 | _ => return Err(MLError::new(ErrorType::ArgumentError, "SUBCMD_NOT_FOUND")) | 116 | _ => return Err(MLError::new(ErrorType::ArgumentError, "SUBCMD_NOT_FOUND")) |
111 | }; | 117 | }; |
112 | Ok(cmd) | 118 | Ok(cmd) |
@@ -136,6 +142,9 @@ pub async fn get_input(config: Cfg) -> Result<(), Box<dyn std::error::Error>> { | |||
136 | }, | 142 | }, |
137 | Cmd::Download => { | 143 | Cmd::Download => { |
138 | download(config, input).await | 144 | download(config, input).await |
145 | }, | ||
146 | Cmd::Io => { | ||
147 | io(config, input) | ||
139 | } | 148 | } |
140 | } | 149 | } |
141 | } | 150 | } |