Update: read messages from rules/**.toml
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -5,12 +5,28 @@ use quick_xml::de::DeError;
|
||||
use std::{fs, path::PathBuf, process};
|
||||
use yamato_event_analyzer::detections::configs;
|
||||
use yamato_event_analyzer::detections::detection;
|
||||
use yamato_event_analyzer::detections::print;
|
||||
use yamato_event_analyzer::detections::print::MESSAGES;
|
||||
use yamato_event_analyzer::omikuji::Omikuji;
|
||||
use yamato_event_analyzer::toml;
|
||||
|
||||
fn main() -> Result<(), DeError> {
|
||||
configs::singleton();
|
||||
let mut toml = toml::ParseToml::new();
|
||||
&toml.read_dir("rules".to_string());
|
||||
|
||||
for rule in toml.rules {
|
||||
match rule {
|
||||
Ok(_rule) => {
|
||||
let mut message = MESSAGES.lock().unwrap();
|
||||
if let Some(messages) = _rule.rule.messages {
|
||||
for (key, texts) in messages {
|
||||
message.insert_message(key, texts);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
|
||||
let filepath: String = configs::singleton()
|
||||
.args
|
||||
|
||||
Reference in New Issue
Block a user