2019-04-23 23:06:35 +02:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub(crate) struct Options {
|
|
|
|
pub verbose: bool,
|
2019-07-11 15:31:25 +02:00
|
|
|
pub separate_allowed_ips: bool,
|
2019-05-17 19:32:35 +02:00
|
|
|
pub extract_names_config_file: Option<String>,
|
2019-07-31 15:24:52 +02:00
|
|
|
pub export_remote_ip_and_port: bool,
|
2019-04-23 23:06:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Options {
|
|
|
|
pub fn from_claps(matches: &clap::ArgMatches<'_>) -> Options {
|
2019-05-17 19:32:35 +02:00
|
|
|
if let Some(e) = matches.value_of("extract_names_config_file") {
|
|
|
|
Options {
|
|
|
|
verbose: matches.is_present("verbose"),
|
2019-07-11 15:31:25 +02:00
|
|
|
separate_allowed_ips: matches.is_present("separate_allowed_ips"),
|
2019-05-17 19:32:35 +02:00
|
|
|
extract_names_config_file: Some(e.to_owned()),
|
2019-07-31 15:24:52 +02:00
|
|
|
export_remote_ip_and_port: matches.is_present("export_remote_ip_and_port"),
|
2019-05-17 19:32:35 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Options {
|
|
|
|
verbose: matches.is_present("verbose"),
|
2019-07-11 15:31:25 +02:00
|
|
|
separate_allowed_ips: matches.is_present("separate_allowed_ips"),
|
2019-05-17 19:32:35 +02:00
|
|
|
extract_names_config_file: None,
|
2019-07-31 15:24:52 +02:00
|
|
|
export_remote_ip_and_port: matches.is_present("export_remote_ip_and_port"),
|
2019-05-17 19:32:35 +02:00
|
|
|
}
|
2019-04-23 23:06:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|