summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
committerfxqnlr <[email protected]>2023-01-19 18:37:42 +0100
commitf7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 (patch)
tree21d0c7356b55e9b45517fd9ca874dd3270b6bc3a /src/main.rs
parentbe9f74f4fb82b25abd99f7024e0f5eea2691f34f (diff)
downloadmodlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.tar.gz
modlist-f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537.zip
input mostly inplemented, mods missing
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs47
1 files changed, 43 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 39e46e8..10980fb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
1use std::env; 1use std::{env, process};
2 2
3use modlist::{config::Cfg, input::get_input}; 3use modlist::{config::Cfg, input::{get_input, Cmd}, update, download, list, io};
4 4
5#[tokio::main] 5#[tokio::main]
6async fn main() { 6async fn main() {
@@ -11,10 +11,49 @@ async fn main() {
11 args.pop(); 11 args.pop();
12 args.reverse(); 12 args.reverse();
13 13
14 match get_input(config, args).await { 14 let input = match get_input(config.clone(), args).await {
15 Ok(..) => (), 15 Ok(i) => i,
16 Err(e) => { 16 Err(e) => {
17 println!("{}", e); 17 println!("{}", e);
18 process::exit(1);
18 } 19 }
19 }; 20 };
21
22 dbg!(&input);
23
24 match input.clone().command.unwrap() {
25 Cmd::Mod => {
26 Ok(())
27 },
28 Cmd::List => {
29 list(config, input).await
30 },
31 Cmd::Update => {
32 update(config, input).await
33 },
34 Cmd::Download => {
35 download(config, input).await
36 },
37 Cmd::Io => {
38 io(config, input).await
39 },
40 Cmd::Version => {
41 show_version();
42 Ok(())
43 },
44 }.unwrap()
45}
46
47fn show_version() {
48 match std::env::var("DEV") {
49 Ok(dev) => {
50 let devint = dev.parse::<i32>().unwrap();
51 if devint >= 1 {
52 println!("Modlist by FxQnLr v{} (DEV)", env!("CARGO_PKG_VERSION"));
53 } else {
54 println!("Modlist by FxQnLr v{}", env!("CARGO_PKG_VERSION"));
55 }
56 },
57 Err(..) => println!("Modlist by FxQnLr v{}", env!("CARGO_PKG_VERSION")),
58 }
20} 59}