prometheus_wireguard_exporter/src/options.rs

22 lines
615 B
Rust
Raw Normal View History

2019-04-23 23:06:35 +02:00
#[derive(Debug, Clone)]
pub(crate) struct Options {
pub verbose: bool,
2019-05-17 19:32:35 +02:00
pub extract_names_config_file: Option<String>,
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"),
extract_names_config_file: Some(e.to_owned()),
}
} else {
Options {
verbose: matches.is_present("verbose"),
extract_names_config_file: None,
}
2019-04-23 23:06:35 +02:00
}
}
}