|
|
@ -5,6 +5,7 @@ use clap::ArgMatches; |
|
|
|
use crate::config::model::Config;
|
|
|
|
|
|
|
|
fn get_config_for_string(arg_value: Option<&str>, config_value: &Option<String>, default_value: &str) -> String {
|
|
|
|
debug!("arg: {:?}; config: {:?}; default: {}", arg_value, config_value, default_value);
|
|
|
|
String::from(match arg_value {
|
|
|
|
Some(v) => v,
|
|
|
|
None => match config_value {
|
|
|
@ -14,7 +15,8 @@ fn get_config_for_string(arg_value: Option<&str>, config_value: &Option<String>, |
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_config_for_number<T: FromStr>(arg_value: Option<&str>, config_value: Option<T>, default_value: T) -> T {
|
|
|
|
fn get_config_for_number<T: FromStr + std::fmt::Debug>(arg_value: Option<&str>, config_value: Option<T>, default_value: T) -> T {
|
|
|
|
debug!("arg: {:?}; config: {:?}; default: {:?}", arg_value, config_value, default_value);
|
|
|
|
match arg_value {
|
|
|
|
Some(v) => v.parse::<T>().unwrap_or(default_value),
|
|
|
|
None => match config_value {
|
|
|
|