diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..4dd4433 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,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, +} |