diff options
author | fxqnlr <[email protected]> | 2023-04-17 20:30:16 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-04-17 20:30:16 +0200 |
commit | 93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba (patch) | |
tree | 043adeff1c117f3f0e4fe7bffc472c299e01d642 /src/lib.rs | |
parent | 77d2ac94534b12300b5b7eff6e28023d815708eb (diff) | |
download | modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.tar modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.tar.gz modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.zip |
added clap cli, modified (basically) all user interface functions;
changed some functions to easier string handling
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -6,7 +6,7 @@ pub mod db; | |||
6 | pub mod error; | 6 | pub mod error; |
7 | pub mod files; | 7 | pub mod files; |
8 | 8 | ||
9 | use std::path::Path; | 9 | use std::{path::Path, fmt::Display}; |
10 | 10 | ||
11 | pub use apis::*; | 11 | pub use apis::*; |
12 | pub use commands::*; | 12 | pub use commands::*; |
@@ -19,14 +19,7 @@ pub enum Modloader { | |||
19 | } | 19 | } |
20 | 20 | ||
21 | impl Modloader { | 21 | impl Modloader { |
22 | fn to_string(&self) -> String { | 22 | pub fn from(string: &str) -> MLE<Modloader> { |
23 | match self { | ||
24 | Modloader::Fabric => String::from("fabric"), | ||
25 | Modloader::Forge => String::from("forge"), | ||
26 | } | ||
27 | } | ||
28 | |||
29 | fn from(string: &str) -> MLE<Modloader> { | ||
30 | match string { | 23 | match string { |
31 | "forge" => Ok(Modloader::Forge), | 24 | "forge" => Ok(Modloader::Forge), |
32 | "fabric" => Ok(Modloader::Fabric), | 25 | "fabric" => Ok(Modloader::Fabric), |
@@ -35,6 +28,15 @@ impl Modloader { | |||
35 | } | 28 | } |
36 | } | 29 | } |
37 | 30 | ||
31 | impl Display for Modloader { | ||
32 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
33 | match self { | ||
34 | Modloader::Fabric => write!(f, "fabric"), | ||
35 | Modloader::Forge => write!(f, "forge"), | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | |||
38 | pub fn devdir(path: &str) -> String { | 40 | pub fn devdir(path: &str) -> String { |
39 | let p = Path::new(path); | 41 | let p = Path::new(path); |
40 | let dev = std::env::var("DEV"); | 42 | let dev = std::env::var("DEV"); |