1use std::env;
2
3#[derive(Clone, Debug)]
4pub struct Config {
5 pub accident: bool, pub c51: bool, pub logo: bool, pub flying: bool, }
10
11impl Config {
12 pub fn from_args() -> Self {
13 let mut config = Config {
14 accident: false,
15 c51: false,
16 logo: false,
17 flying: false,
18 };
19
20 for arg in env::args().skip(1) {
21 if arg.starts_with('-') {
22 for ch in arg.chars().skip(1) {
23 match ch {
24 'a' => config.accident = true,
25 'c' => config.c51 = true,
26 'l' => config.logo = true,
27 'F' => config.flying = true,
28 _ => {}
29 }
30 }
31 }
32 }
33
34 config
35 }
36}