2019-04-23 21:06:35 +00:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub(crate) struct Options {
|
|
|
|
pub verbose: bool,
|
2019-07-11 13:31:25 +00:00
|
|
|
pub separate_allowed_ips: bool,
|
2019-05-17 17:32:35 +00:00
|
|
|
pub extract_names_config_file: Option<String>,
|
2020-04-07 08:20:19 +00:00
|
|
|
pub interface: Option<String>,
|
2019-07-31 13:24:52 +00:00
|
|
|
pub export_remote_ip_and_port: bool,
|
2019-04-23 21:06:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Options {
|
|
|
|
pub fn from_claps(matches: &clap::ArgMatches<'_>) -> Options {
|
2020-04-07 08:20:19 +00:00
|
|
|
Options {
|
|
|
|
verbose: matches.is_present("verbose"),
|
|
|
|
separate_allowed_ips: matches.is_present("separate_allowed_ips"),
|
|
|
|
extract_names_config_file: matches
|
|
|
|
.value_of("extract_names_config_file")
|
|
|
|
.map(|e| e.to_owned()),
|
|
|
|
interface: matches.value_of("interface").map(|e| e.to_owned()),
|
|
|
|
export_remote_ip_and_port: matches.is_present("export_remote_ip_and_port"),
|
2019-10-13 17:42:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
2019-04-23 21:06:35 +00:00
|
|
|
}
|