diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index d177c3e..32727c7 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,15 +1,20 @@ | |||
1 | use std::{env, process}; | 1 | use std::{env, process}; |
2 | 2 | ||
3 | use modlist::{config::Cfg, input::{get_input, Cmd}, update, download, list, io, modification}; | 3 | use modlist::{config::Cfg, input::{get_input, Cmd}, update, download, list, io, modification, setup}; |
4 | 4 | ||
5 | #[tokio::main] | 5 | #[tokio::main] |
6 | async fn main() { | 6 | async fn main() { |
7 | let config = Cfg::init("modlist.toml").unwrap(); | 7 | let config = Cfg::init("modlist.toml").unwrap(); |
8 | 8 | ||
9 | let mut args: Vec<String> = env::args().collect(); | 9 | let mut args: Vec<String> = env::args().collect(); |
10 | args.reverse(); | 10 | args.reverse(); |
11 | args.pop(); | 11 | args.pop(); |
12 | args.reverse(); | 12 | args.reverse(); |
13 | |||
14 | if args.is_empty() { | ||
15 | println!("Please enter an argument"); | ||
16 | process::exit(1); | ||
17 | }; | ||
13 | 18 | ||
14 | let input = match get_input(config.clone(), args).await { | 19 | let input = match get_input(config.clone(), args).await { |
15 | Ok(i) => i, | 20 | Ok(i) => i, |
@@ -19,8 +24,6 @@ async fn main() { | |||
19 | } | 24 | } |
20 | }; | 25 | }; |
21 | 26 | ||
22 | //dbg!(&input); | ||
23 | |||
24 | match input.clone().command.unwrap() { | 27 | match input.clone().command.unwrap() { |
25 | Cmd::Mod => { | 28 | Cmd::Mod => { |
26 | modification(config, input).await | 29 | modification(config, input).await |
@@ -41,6 +44,9 @@ async fn main() { | |||
41 | show_version(); | 44 | show_version(); |
42 | Ok(()) | 45 | Ok(()) |
43 | }, | 46 | }, |
47 | Cmd::Setup => { | ||
48 | setup(config).await | ||
49 | }, | ||
44 | }.unwrap() | 50 | }.unwrap() |
45 | } | 51 | } |
46 | 52 | ||