adjusted default value when level-tuning option is not defined
This commit is contained in:
@@ -191,11 +191,10 @@ pub struct Config {
|
||||
/// Tune alert levels (default: ./rules/config/level_tuning.txt)
|
||||
#[clap(
|
||||
long = "level-tuning",
|
||||
default_value = "./rules/config/level_tuning.txt",
|
||||
hide_default_value = true,
|
||||
value_name = "LEVEL_TUNING_FILE"
|
||||
)]
|
||||
pub level_tuning: PathBuf,
|
||||
pub level_tuning: Option<Option<String>>,
|
||||
|
||||
/// Quiet mode: do not display the launch banner
|
||||
#[clap(short, long)]
|
||||
|
||||
22
src/main.rs
22
src/main.rs
@@ -251,18 +251,18 @@ impl App {
|
||||
} else if configs::CONFIG.read().unwrap().args.contributors {
|
||||
self.print_contributors();
|
||||
return;
|
||||
} else if std::env::args()
|
||||
.into_iter()
|
||||
.any(|arg| arg.contains("level-tuning"))
|
||||
} else if configs::CONFIG.read().unwrap().args.level_tuning.is_some()
|
||||
{
|
||||
let level_tuning_config_path = configs::CONFIG
|
||||
.read()
|
||||
.unwrap()
|
||||
.args
|
||||
.level_tuning
|
||||
.as_path()
|
||||
.display()
|
||||
.to_string();
|
||||
let level_tuning_val = &configs::CONFIG
|
||||
.read()
|
||||
.unwrap()
|
||||
.args
|
||||
.level_tuning.clone().unwrap();
|
||||
let level_tuning_config_path = match level_tuning_val {
|
||||
Some (path) => path.to_owned(),
|
||||
_ => "./rules/config/level_tuning.txt".to_string(),
|
||||
};
|
||||
|
||||
|
||||
if Path::new(&level_tuning_config_path).exists() {
|
||||
if let Err(err) = LevelTuning::run(
|
||||
|
||||
Reference in New Issue
Block a user