summaryrefslogtreecommitdiff
path: root/src/config.rs
blob: 4dd4433cb6dadfafeb7cad7e76a2d7c2ef73ba56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::{net::SocketAddrV4, path::PathBuf};
use structopt::StructOpt;

lazy_static! {
    pub static ref INSTANCE: Config = Config::from_args();
}

#[derive(Debug, StructOpt)]
#[structopt(author, about)]
pub struct Config {
    #[structopt(
        name = "DIR",
        required = true,
        parse(from_str),
        help = "The path to your data directory"
    )]
    pub data_dir: PathBuf,

    #[structopt(
        name = "ADDR",
        long = "bind-addr",
        required = false,
        default_value = "127.0.0.1:5353",
        help = "Sets the IP address and port to bind to"
    )]
    pub bind_addr: SocketAddrV4,

    #[structopt(
        long,
        short,
        multiple = true,
        parse(from_occurrences),
        help = "Increases log level"
    )]
    pub verbose: u8,

    #[structopt(
        long,
        help = "Creates a fresh data directory at DIR and exits; Fails if DIR exists"
    )]
    pub create_dir: bool,

    #[structopt(long, help = "Imports CSV car data into the data directory")]
    pub import_cars: bool,

    #[structopt(long, help = "Imports CSV parts data into the data directory")]
    pub import_parts: bool,
}